You are viewing limited content. For full access, please sign in.

Question

Question

Regular Expression Help

asked on December 28, 2018

Here is the test value I am using (it wont always be General and Conditions but there will always be a line break and will always be between two $'s):


$General$
$Conditions$

 

I need to pull the word General and then the word Conditions separately. I am using the following reg ex to pull General and it works successfully by pulling the first result of what is between 2 dollar signs:

 

\$(.*?)\$

 

But I do not know a ton about regular expressions and am having trouble pulling Conditions. Any help would be appreciated :)

 

0 0

Answer

SELECTED ANSWER
replied on December 28, 2018 Show version history

To get the first instance, I would use:

[^$]*\$([^\r\n$]+)\$

To get the second, I would use:

[^$]*\$[^\r\n$]+\$[^$]*\$([^\r\n$]+)\$

Or to get a multi value token with all instances, you can use:

\$([^\r\n$]+)\$

But you need to make sure to change the "If multiple matches are found" option

0 0

Replies

replied on December 28, 2018

I think if you set your pattern matching to "all matches as a multi-value token, you'll get both General and Conditions.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.