BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Regular Expressions Board

It worked for me.

 

23790iF8AE4059C5DBD8D4

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 21 of 150
(13,181 Views)

Thanks Jim,

 

I was using the "Search and Replace Pattern VI" with TRUE wired to "replace all?"

It did not replace any.

 

I will convert (create a subvi) using the while loop as you showed and I'm sure it will work. 

I wonder if I stumbled onto a bug with LV2010...

 

R

Message 22 of 150
(13,173 Views)

I didn't even think to try that, but it worked for me.  I just deleted the While Loop and wired the Boolean constant.

 

23794iFBC83965123EF33A

 

Have you right-clicked the node and checked "Regular Expression"?

23796i1AF387017E031FD7

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 23 of 150
(13,168 Views)

d'Oh!!!

 

 

I wasn't using the Matche Regular Expression!!

 

I was using this one!  

 

Well, it partially worked...  😉

 

 

Message 24 of 150
(13,147 Views)

I used Search and Replace String, not Match Regular Expression.

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 25 of 150
(13,140 Views)

I've posted another Regexp solution here which explains the following expression: (-?[\d]+\.?[\d]*)|(-?\.[\d]+).  I used it to extract numbers from a string.

It made me think of the expression, "If the only tool you have is a hammer, you tend to see every problem as a nail." ~ Abraham Maslow

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 26 of 150
(13,024 Views)

Regular Expressions: Now you have TWO problems

 

Lots of interesting info and tools listed in the Coding Horror blog post. What about LabVIEW?

 

I needed to process a bunch of old TestStand 1.0 and 3.0 HTML reports for import into a database. I thought, what a great way to learn regular expressions!

 

After some research, I kept reading "you can't use regex to parse HTML". Since I had structured HTML in two different flavors (basically out of the box reportgen_html and a couple of additions to the header) I tried anyway and came up with this. I had to parse the data further, but that was specific to my application. This VI was used to clean the HTML tags.

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 27 of 150
(12,974 Views)

Thanks Philip,

 

I will probably borrow from your code when I get a chance to return to the project that I was working on and posted earlier in this thread.

 

You should submit this for the example code contest.

Message 28 of 150
(12,960 Views)

See here for an example to toss bad nodes in a VRML file.

 

Two solutions offered are;

 

ben.png

 

and

 

regex solution.png

 

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 29 of 150
(12,795 Views)

I answered this question:


@emyh wrote:

 

[...] have: C1-C10

(C1-C10 means there are actually ten cmponents; C1, C2, C3...C10)

I now want to convert the array containing C1-C10 into an array looking like this:

 

C1

C2

C3

.

.

.

C10

 

[...]


... with this Regexp:

 

Example_VI.png

 

Read the Regexp like:

 

  • ([A-Z])  find an upper case alpha-character and store it in a backreference
  • ([0-9]+) find one or more digits and store it, too, in a backreference
  • - find a "-"
  • (\1) find what was found in the first backreference.  In this example it will find a "C" at the beginning and search again for a "C"
  • ([0-9]+) find another one or more digits and store it in a backreference
I'm only using one of the backreferences, but the others are so I can expand the node and get at each of them (in order of appearance in the regexp).

 

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 30 of 150
(12,607 Views)