Jump to content

Need help with regular expressions


Recommended Posts

Hello,

I'm trying to parse a version number of format 00.00.00.00 from some telnet traffic.

I get several lines of output from telnet when I send it a "version" command.

I'm using the match pattern function on the returned lines and among the regex-es I used are:

\d\d\.d\d\.d\d\.d\d\

m/([0-9]{2}.){3}[0-9]{2}/

and variants of these, as well as other regex-es.

I always get the version string plus the several lines afterward. as though the regex is being ignored.

Is there anything about how LV implements regex that quirky , or some issue I should know about?

Thanks!

J

Edited by jbabb
Link to comment

Hello,

I'm trying to parse a version number of format 00.00.00.00 from some telnet traffic.

I get several lines of output from telnet when I send it a "version" command.

I'm using the match pattern function on the returned lines and among the regex-es I used are:

\d\d\.d\d\.d\d\.d\d\

m/[0-9].{3}[0-9]/

and variants of these, as well as other regex-es.

I always get the version string plus the several lines afterward. as though the regex is being ignored.

Is there anything about how LV implements regex that quirky , or some issue I should know about?

Thanks!

J

Can you post more of the surrounding data? Also, are you simply trying to extract the version string out of the data?

Link to comment
Is there anything about how LV implements regex that quirky , or some issue I should know about?

I don't have LabVIEW at home so I can't test anything, but there's a comment in the help for Match Regular Expression that says:

The Match Regular Expression function gives you more options for matching strings but performs more slowly than the Match Pattern function.

I've had trouble using Match Pattern and fixed the problems by using Match Regular Expression.

I'm also thinking that \d\d\.d\d\.d\d\.d\d\ should be \d\d\.\d\d\.\d\d\.\d\d instead and that m/[0-9].{3}[0-9]/ might be better as ([0-9]\.[0-9]){3}.

I sure wish I could test this in LabVIEW...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.