Avatar of chaituu
chaituu
Flag 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
Regular ExpressionsJava

Avatar of undefined
Last Comment
CEHJ

8/22/2022 - Mon
Rgonzo1971

HI,

pls try
workspace:\/\/SpacesStore\/

Open in new window

REgards
CEHJ

That's ONE input string?
chaituu

ASKER
That's ONE input string?

yes
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
CEHJ

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

chaituu

ASKER
its working.May i know the meaning of this expression?
ASKER CERTIFIED SOLUTION
CEHJ

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
chaituu

ASKER
what is the meaning of this ?:[a-f0-9]+-){4}  ???
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
CEHJ

Capture groups of lower case hex characters separated by hyphens
Shaun Vermaak

See the explanation section on the right-hand side of
https://regex101.com/r/L5FxH4/1
CEHJ

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)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
CEHJ

:)