DATA Step, Macro, Functions and more

Regex to remove (anythng) from string?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

Regex to remove (anythng) from string?

I'm trying to use:

x=prxchange('s/\(*[^)]\)//',1,x);

to remove text between two parens (including removing the parens) from a string.  However, this isn't working completely.   If the string is:  "this is a test (hello world)", i'm getting "this is a test (hello world".

What's the right regex to use to accomplish this?


Accepted Solutions
Solution
‎12-19-2012 05:43 PM
Frequent Contributor
Posts: 87

Re: Regex to remove (anythng) from string?

Posted in reply to SciFiGuy0

Try:

x=prxchange('s/\(.*\)//',1,x);

cheers

Steve

View solution in original post


All Replies
Solution
‎12-19-2012 05:43 PM
Frequent Contributor
Posts: 87

Re: Regex to remove (anythng) from string?

Posted in reply to SciFiGuy0

Try:

x=prxchange('s/\(.*\)//',1,x);

cheers

Steve

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 134 views
  • 0 likes
  • 2 in conversation