Not signed in (Sign In)

Categories

Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorprozente
    • CommentTimeAug 10th 2007 edited
     permalink

    I’ve been testing out the regex in the search and replace and I’m having a problem with using back references.

    I’m using some pseudo text (see below) and what I was trying to do is swap the places of the letters with the numbers.
    I tried using: ([\w]+)_([\d]+)$ for the search term so the letters should be the first back reference and the digits should be the second back reference. But when I put:
    \2_\1 as the replacement text it doesn’t work as I’d expect. Have I overlooked something or is this a bug?
    Any insight would be appreciated.

    Pseudo text:
    foo_1234 bar_1237 foobar_3244 foo_2352 bar_2362 barfoo_1213 foo_6472 bar_7832 foo_8293 bar_3609 foobar_1239

    Result Text:
    2_1 2_1 2_1 2_1 2_1 2_1 2_1 2_1 2_1 2_1 2_1

    Edit: I just noticed an error with the “Preview Post” when previewing a post it requires you to escape backslashes in order for them to show up but when you make the actual post all of the slashes appear.

    •  
      CommentAuthortstrokes
    • CommentTimeAug 10th 2007 edited
     permalink

    Try $2_$1 as a replace string.

    • CommentAuthorprozente
    • CommentTimeAug 10th 2007
     permalink

    Ah works :) Thanks.