Link to home
Start Free TrialLog in
Avatar of vsidorenko
vsidorenko

asked on

Regex to capture everything between two characters

I am try to write a regex that will capture the values between two characters. The  text input looks like this


From: http://www.loremIpsum/descpage-MRD19M7.html
To: http://www.loremIpsum.au/invisdescpage.html?PCODE=MRD19M7



I need it to Capture the MRD19M7 & MRD19M7

In the first case it will always be between - & .
and in the second case it will be between the = and white space char

So far I have this  /-|=?[A-Z]\w+/g
But this Captures PCODE=MRD19M7   & -MRD19M7  from the other line

I have been using http://regexr.com/ to test.

Would appreciate any help on this
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vsidorenko
vsidorenko

ASKER

Thank you, appreciate reply. Is there a reason that regex has a matched text and capture group 1?  is there a way to have the matched text exclude the characters - and = or is this just how regex functions.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanx 4 axxepting