[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reqular Expressions: How to find string that match start with |

Posted on 2014-02-21
2
Medium Priority
?
285 Views
Last Modified: 2014-02-21
I want to remove GUID from string. Guid start with | character. I can remove guid using [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}, but how to find results starting wiht |?

Currently Mr Nice |d60205ce-e85e-48d4-8cf5-8ab55ba641dc would be "Mr Nice |" , but I need to remove first "|". Result should be Mr Nice.
0
Comment
Question by:tolppa
2 Comments
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 2000 total points
ID: 39876597
(.*)\|(\w*-){4}\w*

Your desired result will be in group 1.

Or, if you only want to delete the GUID, use:
\|(\w*-){4}\w*

HTH,
Dan
0
 
LVL 1

Author Closing Comment

by:tolppa
ID: 39877302
Perfect.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question