Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using regexxer to translate an application that use .php files. In accordance to the webpage it's based on usage and syntax of Perl regular expressions. It looks more to be applied to Perl code. I'm not experienced in regex and the most "complex" things I've achieved are:

Search: 'Name must be between (\d+) and (\d+) characters!'
Replace: '¡Nombre debe tener entre $1 y $2 caracteres!'


Search: 'Password(:|')
Replace: 'Contraseña$1

With +200 files and 5/50 lines/vars each one I can save hours/days with less and more complex regex. How can I do this?:

Search: '(any word) must be between (\d+) and (\d+) (other word)!'
Replace: '¡$1 debe tener entre $2 y $3 $4!'

and this? (find any string that begins with 'Warning: ' and ends with '!' in order to replace 'Warning: ' with 'Advertencia: ¡'):

Search: 'Warning: File not found!'
Replace: 'Advertencia: ¡Archivo no encontrado!'

Please help me what to type into regexxer.

share|improve this question
regex coach is a nice free program for testing regexes. jgsoft make some regex related tools that aren't free. – barlop Dec 24 '12 at 17:35
up vote 1 down vote accepted

This regex matches between two strings


e.g. it matches for this text, between first and last. firstfgdfgfddlast

tested in (took me a while to find an online regex tester that worked! I guess many don't support lookbehind. But that one is good).

Improvement added by quantme-
In regexxer:

Search: 'Warning: (.*?)!'
Replace: 'Advertencia: ¡$1!'
share|improve this answer
It works exactly as I need! And the online regex tester is great! – quantme Dec 24 '12 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .