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: 
You can solve it using Regex. Everytime we are looking for patterns where number is followed by characters and if it is found, print it:

```
        String text = "123testes1233stackoverflowwillsaveyou123dontworry";
        String wordToFind = "\\d+[a-z]+";
        Pattern word = Pattern.compile(wordToFind);
        Matcher match = word.matcher(text);

        while (match.find()) {
            System.out.println(match.group());
        }

```
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));
}

```