Page 1 of 1

Regex in search/replace

Posted: Wed Apr 12, 2006 8:30 pm
by maltit
Hi,

first let me use this occasion to thank you guys from the Oxygen team for this great tool. I'm discovering a new life-easier-making feature almost every day.

I'm wondering if it's possible to use the regex option in the search/replace function to do things like transform groups or characters into upper case. I have been trying this for a little while now without success. What kind of syntax to I have to use?

Thanks,
Oli

Posted: Thu Apr 13, 2006 10:43 am
by sorin_ristache
Hello,

You have to enable the Regular expression checkbox of the Find/Replace dialog. In the Text to find combo insert a Perl 5 regular expression and in the Replace with combo you can use regular expression groups like $1, $2, etc. For example to replace the tag with attributes called tag-name with the tag tag-name1 use as text to find <tag-name(\s+)(.*)> and as replace text <tag-name1$1$2>

Regards,
Sorin

Posted: Thu Apr 13, 2006 11:44 am
by maltit
Sorin,

I already found out about that. My question is: does the replace with combo accept perl expressions beyond just references to the groups, allowing to transform things to upper/lower case and such?

Regards,
Oli

Posted: Thu Apr 13, 2006 12:25 pm
by sorin_ristache
Hello,

You can use expressions like \p{Lower} and \p{Upper} for matching lower case letters and upper case letters if you enable the case sensitive and regular expression options but you cannot transform lower case to upper case using the replace with expression. The constructs supported as regular expressions are described here.

Regards,
Sorin