06-03-2009 07:52 AM
Hello,
I would like to use the "Match Pattern" or the "Match Regular Expression" vi simply because of the outputs that these vi's provide. The output I am interested in is the "after substring". I want to be able to specify a "substring" and get whatever is after the substring from the input string. However I am getting all confused and/or hosed up when it comes to "regular expressions". Is there a way to create a "regular expression" that will act as is it is a "substring" to find within the input string?
The substring is a partial dir path that contains colons, backslashes, etc that are part of a directory path. So some how the "regular expression" input has to ingnore all of the special characters and simply figure out where the substring is within the input string and give me "all of the stuff" after the substring in the "after string" output.
Solved! Go to Solution.
06-03-2009 08:04 AM
The back slash (\) used in a file path is also a special character in regular expression so you must precede any back slash that you wish to find with a back slash. Like “C:MyDir\\MyFile”
Colons are ok.
Post an example of what it is you are looking for and I will create a regular expression for you.
Omar
06-03-2009 09:59 AM
Hello,
Here is a example of a of the string value that I want to send to the input string
\\crnas03\home\my documents\test_folder\dir1\dir2\dir3\dir4\file.txt
Here is the input string that needs to be tweaked to turn into a "regular expression"
\\crnas03\home\my documents\test_folder\dir1\dir2
I am aware that I will have to uses the "seach and replace" vi to modify it. I would like to get the following output
\dir3\dir4\file.txt
06-03-2009 10:28 AM
06-03-2009 11:19 AM
Hello,
It works! Thank you!
07-22-2021 11:34 AM
Hi there, thank you for your answer. I completely forgot about escape characters in strings! Anyway, this works for me using both Match Regular Expression as well as Match Pattern. You said to use the former, as "it's better." Could you elaborate on why you say that Match Regular Expression is better?
Thank you
07-22-2021 02:28 PM