User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Find, replace, find in files, replace in files, regular expressions
3 posts Page 1 of 1
Is there a way to rewrite the following regex so the replacement becomes defined. My understanding is embedded parentheses cause the replacements \1, \2, etc. to become undefined.


Sample entries this should match. The part in red should be deleted in the replacement. I'm trying to guarantee this only occurs on a line with SVC*.

Use as search string: (SVC\*HC(?::\w{2,})+):\w(\*)

?: immediately after opening parenthesis changes the group from a marking group to a non marking group. Non marking groups can be nested in other non marking groups or in marking groups. Non marking groups should be always used when back-referencing the string found by the expression inside a group is not needed.
Best regards from Austria
Thanks Mofi that worked. My replacement was \1\2 and it worked.

I could've made the asterisk at the end a look ahead and thus just would've needed \1 as the replacement. Thanks for the tip on the embedded parentheses trick.

3 posts Page 1 of 1