JasonPJohnson
asked on
Regex Help
I need help with a regex to match any one of these cases.
I'm close my problem is the spaces in the after the line breaks. I really need to eval it as a single uuid.. I am working on a calendar migration and I'm trying to find old UUID's and replace them. I attached the entire file just incase you want to see what I am working with.
ATTENDEE;CN="Jason Johnson";CUTYPE=INDIVIDUAL;EMAIL="jason_johnson@sweet
water.com";PARTSTAT=ACCEPTED:urn:uuid:2F00405F-6019-494D-BB8F-368758197A
11
ATTENDEE;CN="Joe McNeely";CUTYPE=INDIVIDUAL;EMAIL="joe_mcneely@sweetwate
r.com";PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE;SCHEDULE-STA
TUS="1.2":urn:uuid:D6ABEECD-2352-4777-8567-369B6FD2FA43
ATTENDEE;CN="Mike Lentine";CUTYPE=INDIVIDUAL;EMAIL="mike_lentine@sweetwa
ter.com";PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT;SCHEDULE-STATUS="2.0":ur
n:uuid:9D2E81FD-97C4-44E0-951F-B67FF8FB8394
ATTENDEE;CN="Jason Johnson";CUTYPE=INDIVIDUAL;EMAIL="jason_johnson@sweet
water.com";PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:urn:uuid:2F00405F-6019
-494D-BB8F-368758197A11
ATTENDEE;CN="John Hopkins";CUTYPE=INDIVIDUAL;EMAIL="john_hopkins@sweetwa
ter.com";PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:urn:uuid:AF78E76B-7447-4
1E8-AC7E-51C27A9BEB5B
I'm close my problem is the spaces in the after the line breaks. I really need to eval it as a single uuid.. I am working on a calendar migration and I'm trying to find old UUID's and replace them. I attached the entire file just incase you want to see what I am working with.
(?s)urn:uuid:.{8}-.{4}-.{4}-.{4}-.{12}
Jason-Johnson-1.txt
ASKER
this seems to work better.
(?s):u\s*r\s*n\s*:\s*u\s*u \s*i\s*d\s *:.\s*.\s* .\s*.\s*.\ s*.\s*.\s* .\s*-.\s*. \s*.\s*.\s *-.\s*.\s* .\s*.\s*-. \s*.\s*.\s *.\s*-.\s* .\s*.\s*.\ s*.\s*.\s* .\s*.\s*.\ s*.\s*.\s* .\s*
(?s):u\s*r\s*n\s*:\s*u\s*u
This would be a bit neater:
urn:uuid:(\S\s*){8}-(\S\s* ){4}-(\S\s *){4}-(\S\ s*){4}-(\S \s*){12}
urn:uuid:(\S\s*){8}-(\S\s*
Can you strip out the spaces before applying the regex? That would be simpler.
ASKER
I tried to find and replace spaces but it wont import in to zimbra after words and I can't seem to figure out how to add them back in.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Split the tasks into steps:
$blob=<FILE>;
$blob =~ s/\n //g;
@datasets=split("\n",$blob );
... then you can tackle each dataset separately and you don't end up with a regex which is hell to maintain.
$blob=<FILE>;
$blob =~ s/\n //g;
@datasets=split("\n",$blob
... then you can tackle each dataset separately and you don't end up with a regex which is hell to maintain.
ASKER
Thanks perfect
ASKER
urn:uuid:(?s).\s*.\s*.\s*.