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
I'm looking to search for all \(\d+\) expressions in a file which satisfy the below conditions:

1. The expression "\(\d+\)" should not be immediately followed by the string "</xref>"
2. The search should avoid any/all expression "\(\d+\)" if that expression is inside tags "<inline>....</inline>" and "<disp>...</disp>"

sample text:(just random gibberish text)

I <xref rid="eqn1">(1)</xref> dsf dsf fd (6) dfd dsf dfds sdfds dsfds
(16) to dsfds <inline>df fds (10) dsf</inline> fsdf <disp>adf dsf df (3)fa</disp>
lp fds f dsf sfds <inline>df fds (5)</inline>

The search pattern will only find the red colored expressions in the above sample.
\(\d+\)(?!</xref>) only satisfies the 1st condition and I cannot figure out how to add condition 2 into the mix(if possible at all)

Can anyone help :|
Hi,

I suppose that the 2nd condition is not met for nested tags (e.g. (10) in <inline>df fds <value>(10)</value> dsf</inline> should be find).
I also suppose that check for closing tags is enough (opening tag has to be there in the valid code, hasn't it?)
Then you could try this simple pattern:

\(\d+\)(?!</xref>)(?![^<]*</(inline|disp)>)

BR, Fleggy
Thanks fleggy. It works fine as of now. :mrgreen:
3 posts Page 1 of 1
cron