BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Regular Expressions Board

I think this is more like the Excel board where we can ask questions.  At least that's how I've used it..

0 Kudos
Message 81 of 150
(8,612 Views)

@smercurio_fc wrote:

But then regular expressions are pure gibberish to me anyway, so it's not that big a of surprise. I get a headache every time I look at them or have to use them.


"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems."

 

From Atwood with the quote attributed to jwz.org Smiley Happy

Message 82 of 150
(8,596 Views)

Amen to that - I have to put a detailed explanation next to each Regex value, because I know in six months time when I go back to look at it I'll be thinking what the hell is that doing!!

 

P.S. Sorry if this was not the proper thread to be asking questions on Regular Expressions.

 

Chris

0 Kudos
Message 83 of 150
(8,572 Views)

I just found out the hard way (scratching my head in a 15min debugging session) that character class negation is different between the Match Pattern Function and the Match Regular Expression Function.

 

Here's an example from the Help Docs:

Match Pattern Function:

One or more characters other than digits [~0-9]+

Match Regular Expression Function:

One or more characters other than digits [^0-9]+

 

Character class negation is the tilde for Match Pattern, and the caret for Match Regular Expression (and the rest of humanity).

 

If anyone can offer a history lesson on the legacy of tilde usage (calling all Darins Smiley Tongue ) feel free to hop in Smiley Happy

Spoiler
(Just sharing this knowledge to be indexed by the googles for posterity's sake)
Message 84 of 150
(8,509 Views)

Match Pattern with [^0-9] will give you the displayable characters which are not 0-9, sort of pseudo-negation.

 

As for a history lesson: Rolf and I had a very interesting discussion about this particular feature.  There was an evolution between LV7 and LV9, very annoying.

 

http://forums.ni.com/t5/LabVIEW/Bug-in-Match-Pattern-in-LabVIEW-2010/m-p/1488048#M561533

Message 85 of 150
(8,477 Views)

Here is a basic regEx which can be used to extract command and value from a string.

It has to work on the fact that the script is written by different people and the syntax may / will have variations.

 

For instance value / seperator / command,

where the seperator can be a white space or a comma:  , or \s or \t or ,\s or ,\t

or in a wose case scenario: ,\s\t 

 

There are other ways of doing this, but can quickly become messy...

 

Message 86 of 150
(8,440 Views)

I wrote a Rube Goldberg expression.

It could have been simplified to :

 

[0-9]+[, \t \s]+

 

 

And the expression can be extended to include the command:

in the format :  command \ delimiter \ value \ delimiter \ operation

 

Message 87 of 150
(8,431 Views)

@Ray.R wrote:

I wrote a Rube Goldberg expression.

It could have been simplified to :

 

[0-9]+[, \t \s]+

 

 

And the expression can be extended to include the command:

in the format :  command \ delimiter \ value \ delimiter \ operation

 

 


Don't forget that the search and replace has a regex option...

 

Message 88 of 150
(8,380 Views)

very nice Paul.

Thanks

0 Kudos
Message 89 of 150
(8,344 Views)

From Philip Brooks:

 

Message 90 of 150
(8,283 Views)