BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Geek award

I think this answer really deserves a geek award (talking regexpr like other talk klingon):

 

http://forums.ni.com/t5/LabVIEW/regex-making-my-head-spin/m-p/1181895#M512413

 

Felix

Message 1 of 26
(15,912 Views)

@f. Schubert wrote:

I think this answer really deserves a geek award (talking regexpr like other talk klingon):

 

http://forums.ni.com/t5/LabVIEW/regex-making-my-head-spin/m-p/1181895#M512413

 

Felix


I second the motion.  Anyone who can come up with an expression like that is not human. Smiley Wink

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 26
(15,904 Views)

Unbelievable !

0 Kudos
Message 3 of 26
(15,871 Views)

 

 

 

 

 

 

Where did he........19003i4008440F890FE6E8.... how is that formula....19001iF4F8FA665D4CC284

..

 

.. 

0 Kudos
Message 4 of 26
(15,866 Views)

I love posts about Regular Expressions because they're are so intriguing.  Any time I use one, however, I feel that I'm sacrificing readability for (my interpretation of) elegance.  Sometimes I feel it would be better to simply pull strings apart and look for stuff the old fashioned way so folks unfamiliar with regexps don't, in an effort to maintain or extend my code, find the regexp, get frustrated with the hieroglyphics and track me down and kill me.

I'd like to do a benchmark on forimstuck's problem, comparing a regexp solution with a more common approach when handling large inputs.

 

Edit - I put a (somewhat) more readable version on the original thread.  I'll explain the regular expressions I used during my lunch hour.

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

Message 5 of 26
(15,851 Views)

Jim,

 

That regular expression is awesome.

 

I did follow that thread and got lost when I looked at it.  So I decided to copy the code and carry out regexpr experiments on my own and extend my understanding of it.  My C code would certainly benefit from knowing more regexpressions and the power behind them.

 

You'll have to add "RegExpr King" to your signature.

 

RayR

 

(regexp novice)

 

0 Kudos
Message 6 of 26
(15,836 Views)

 


@jcarmody wrote:

.  Sometimes I feel it would be better to simply pull strings apart and look for stuff the old fashioned way so folks unfamiliar with regexps don't, in an effort to maintain or extend my code, find the regexp, get frustrated with the hieroglyphics and track me down and kill me.


Love the code!  mind-blowing!  and without a DETAILED comment in the code, preferably with revision history comment blocks (even old regexpr constants and commanets to preserve history in case of back-revision) you would probably need to enter the witness protection program. Smiley Very Happy

 

 

this is a perfect example of Elegance vs Maintainability - I'm sure the repost after lunch will solve that problem elegantly as well.  I'm looking forward to reading it!


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 26
(15,823 Views)

How does one become a regex ninja?  Practice.  Here is a VI I use for testing regexes.  

 

All my regexes live in Texas....  

Message 8 of 26
(15,813 Views)

Thanks for sharing Darin.

 

That's a nifty little tool.  I like the fact that it highlights what the regular expression matches.  That's make it a whole lot easier to debug the expression.

0 Kudos
Message 9 of 26
(15,801 Views)

 jcarmody wrote:

[...] I'll explain the regular expressions I used during my lunch hour.


 

This is my final attempt:

 

16 {1}|[0-9]1 6|1 *[\w\d]{6}\s.*: *6

 

There are three parts to this regexp, the "|" (pipe) separates them and is an OR operator.

The first part is: 16 {1}
  This looks for a literal "16" followed by only one space. The prevents the line number or
  something in the last column from matching.

The second part is: 1 6
  This looks for a literal "1 6"


The last part is: 1 *[\w\d]{6}\s.*: *6
  This finds the instances where there is a 1 at the end of one line and a 6 at the beginning
  of the next. The expression begins and ends with a 1 and 6, it's the stuff in between
  that makes this work.
    <space>* looks for zero or more spaces
    [\w\d] looks for any alpha-numeric character
    {6} looks for exactly six of them
    \s looks for whitespace, it'll catch the line-feed, new line or carriage return
    .*: matches the line number, spaces and colon
    <space>* gets zero or more spaces

Darin.K, thanks for your help again.  I've put your regexp tester into my /project folder.  I learned to use variants this way from your post here.

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

Message 10 of 26
(15,786 Views)