Regex in search/replace

Having trouble installing Oxygen? Got a bug to report? Post it all here.
maltit
Posts: 7
Joined: Thu Jan 26, 2006 4:26 pm

Regex in search/replace

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
maltit
Posts: 7
Joined: Thu Jan 26, 2006 4:26 pm

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply