Jump to content

Regular expressions and case structures?


Recommended Posts

Does anybody know if there is a way to select a case using regular expressions instead of exact strings or ranges?

What I want to be able to do is the following:

Say I have some strings like this:

"FOO BAR"

"FOO POST"

"HELLO WORLD"

"HELLO USA"

What I want to do is have a case structure with 2 cases... "FOO" and "HELLO". If I wire any of the above strings to the case, I want it to select the case that matches the string segment before the whitespace, regardless of what's after the whitespace.

Now the kicker... I would like to do it without using "Match Pattern" or any other extra VIs.

I tried entering regular-expression-type values into the case structure, and got a non-unique case error. Is there a regular expression-type syntax that can be entered to accomplish this? I've already tried using "..." as explained in LabVIEW Help, and it appears I can only use it in one case, or I'm using it wrong.

If LabVIEW doesn't support regular expressions in their case structures... perhaps they should consider it for future versions?

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.