LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression

Solved!
Go to solution

Hi,

 

What is the meaning of below regular expression which is used in Match Regular Expression function

 

(\w+)\s+\(part number (\d)\):\r\n((\s{5}.*\r\n)+)

 

Thanks

0 Kudos
Message 1 of 5
(3,153 Views)

 

(\w+)\s+\(part number (\d)\):\r\n((\s{5}.*\r\n)+)

 


It looks like it's looking for text before a part number and the part number itself (although only one digit?).  Do you have the text this is searching?

 

http://www.regular-expressions.info/reference.html is my favorite place to learn about Regular Expressions.

 

(\w+) = find one or more word character(s) and store the result for later

\s+ = find one or more spaces

\( = find a literal opening parenthesis

part number  = find the literal string "part number "

(\d) = find a digit and store the result for later

\):\r\n = find a literal closing parenthesis followed by a colon, carriage return and line feed

( = begins a group which ends with the ) at the end of your regexp

(\s{5}.*\r\n) = find five white spaces followed by any character repeated until a carriage return and line feed

+ = find one or more of the above...

 

word character = letter, digit or underscore

white space = spaces, tabs, and line breaks

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 5
(3,141 Views)

No.. I dont have input string... Thanks for input..

0 Kudos
Message 3 of 5
(3,138 Views)
Solution
Accepted by topic author Aspiration

This is what I imagine:

 

undefined

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 4 of 5
(3,118 Views)

Thanks jcarmody

0 Kudos
Message 5 of 5
(3,087 Views)