Question: I have this code:

```
{% set foto = 'photo_gallery/' ~ {{ image.id }} ~ '/' %}
{% set thumbs = 'photo_gallery/thumbs/' ~ {{ image.id }} ~ '/' %}

<img src="{{ pageTemplate.pageHeader.mainUrl }}{{ image.image |replace({foto: thumbs}) }}">

```

This is give me error:

```
Fatal error: Uncaught Twig_Error_Syntax: A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{". in ......

```

How repair it?

Answer: 
One way to do it would be to use [`StringTokenizer`](https://docs.oracle.com/javase/10/docs/api/java/util/StringTokenizer.html). If you make the assumption that every output line must start with `123`, even if the input doesn't start with it, it could be:

```
String input = "123testes1233iambeginnerplshelp123 ..";
String delimiter = "123";
StringTokenizer tokenizer = new StringTokenizer(input, delimiter);
while (tokenizer.hasMoreTokens()) {
  String line = delimiter + tokenizer.nextToken();
  System.out.println(line);
}

```
my solution

```
public StringSplitNum(){ 
    String someString = "123testes1233iambeginnerplshelp123abc";
    String regex = "((?<=[a-zA-Z])(?=[0-9]))|((?<=[0-9])(?=[a-zA-Z]))";
    List arr = Arrays.asList(someString.split(regex));
    for(int i=0; i< arr.size();i+=2){
    System.out.println(arr.get(i)+ " " + arr.get(i+1));
}

```