Jump to content
Sign in to follow this  
qwert

Need help with an advanced RegExp call

Recommended Posts

qwert

In conjunction with my recent post on taming script abort messages, I've determined that I CAN alter the text of the message.  For example, the following statement in the Dll Call changes both text lines in the displayed abort message.

StringRegExpReplace($sText, "(.+)", "This is a test ...")

But what I'd like to do is:

(1) remove all text bracketed by ( ... ) in the first string ... IOW, by the parenthesis pair

(2) replace the entire second string with my own text

In other words, have the result appear in this form:

Good solution.png

Numerous searches and my own meager knowledge of RegExp format didn't produce anything useful.

I can eventually figure out the first replacement, but can someone point me to an example that shows how to replace the second string—any second string—with my text?  I really don't have a handle on that one.

Thanks for any assistance.

 

Edited by qwert

Share this post


Link to post
Share on other sites
qwert

For (1), above, I've found that the following RegExp will locate and replace the parenthesized string:

StringRegExpReplace($sText, "\([^)]*\)", "This is a test ...")

That leaves (2) as the problem to solve.

Share this post


Link to post
Share on other sites
kylomas

qwert,

Post #9 in your "clang" thread is not what you want?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
qwert

You are correct in pointing that out.  I posted my full RegExp statement there because I had started that thread with the Intercept_MessageBoxW function.

For anyone following this thread, here's the link to it.

Share this post


Link to post
Share on other sites
ViciousXUSMC

The best tool to experiment, and learn regex for me: https://regex101.com/

Should let you do some quick testing and debugging. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×