Reputation: 778
What I am trying to do is, if I have a text like this: "this is an example 23*45 and 34". I want to get "23*45" and "34". I have no problem finding ether "23*45" or "34" but having problem getting both of them at the same time.. This is what I got now:
"(-?)([0-9]+)\*(-?)([0-9]+)"
Upvotes: 0
Views: 50
Reputation: 163207
To get "23*45" and "34", you might use:
Explanation
\d+
(?:
\*\d+
)
?
Upvotes: 3