Link to home
Start Free TrialLog in
Avatar of chaituu
chaituuFlag for India

asked on

How to write regex expression to remove particualr string

Hi,

How to write regex expression for below string to get the final output as

"d1a2227e-291f-4d82-8991-b9458b4ad0d3","fb48e632-3c85-483b-86b3-76f7a1c7eb25","93fa5301-29e2-4ef6-9353-686868686888"



input string= @Check:"workspace://SpacesStore/d1a2227e-291f-4d82-8991-b9458b4ad0d3" OR @Check:"workspace://SpacesStore/fb48e632-3c85-483b-86b3-76f7a1c7eb25" OR @Check:"workspace://SpacesStore/93fa5301-29e2-4ef6-9353-686868686888
Avatar of Rgonzo1971
Rgonzo1971

HI,

pls try
workspace:\/\/SpacesStore\/

Open in new window

REgards
That's ONE input string?
Avatar of chaituu

ASKER

That's ONE input string?

yes
You might try something like this (where input string is 's')

        Pattern p = Pattern.compile("/([a-f0-9\\-]+)\"");
        Matcher m = p.matcher(s);
        while (m.find()) {
            System.out.println(m.group(1));
        }

Open in new window

Avatar of chaituu

ASKER

its working.May i know the meaning of this expression?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

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 chaituu

ASKER

what is the meaning of this ?:[a-f0-9]+-){4}  ???
Capture groups of lower case hex characters separated by hyphens
See the explanation section on the right-hand side of
https://regex101.com/r/L5FxH4/1
Sorry - let me be a little more precise:
Capture groups of lower case hex characters followed by hyphens four times (the remainder of pattern is explained by the first seven words [only] of this sentence)
:)