How do I have to define a regular expression to filter out data from file?

Hi all,
I need to extract parts of lines of a ASCII file and didn't get it done with my low knowledge of regular expressions
The file contains hundreds of lines and I am just interested in a few lines, within that lines I just need a part of the data.
One original line looks like that:
TP3| |TP_SMD|Nicht in Stueckliste|~TP TP_SMD TESTPUNKT|-|0|87.770|157.950|0|top|c| |other|TP_SMD|TP_SMD_60RF-TP
Only the bold and underlined information is of interest, I don't need the rest.
I can open that file, read in each line but then I am struggling to pick out only the lines of interest (starting with TP), taking that TP with its number and the coordinates following later on and then writing these shortened lines to a new text file. So the new line should look like that:
TP3; 87.770;157.950;0 (It doesn't matter if the separator will be ; or |)
I thought of using regular expressions - is that the right way or is there a better approach?
Thanks & regards,
gedi, using LabVIEW 8.5
Regards,
gedi

Hi max,
for finding a specific part of a string you can use the "Match Pattern" VI, it is located in the Strings Palette.
Maybe the Extract Numbers.vi example in the examples browser library can help you.
What I did to filter out my data of interest is first to sort out only the columns which I want to have -
then there are still a lot of lines remaining I don't need (this is the thing described above).
The rest I am going to filter out with a (then easy) regular expression with the "Match Pattern" VI.
Regards,
gedi
Regards,
gedi

Similar Messages

  • Regular Expression to Filter Out Special Case

    I wonder if anybody knows how to use regular expressions to match any possible string in existence, exception one?
    For example, lets say the string I DON'T want to match is "Foo".
    Then I want a regular expression that will match (and capture) everything except EXACTLY "Foo". Therefore, "FooBar" is ok, "FooFoo" is ok, "Fool" is okay, "Java" is okay, "Supercalifragilistic Expialadocious" is okay. Absolutely anything, exception exactly "Foo".
    Does anybody know if or how this can be done, using regular expressions (I know I could simply test for .equals, but the problem is, I don't have control of the code that does the validation. All I can do is supply a regular expression, and let the framework do the rest).
    Thanks,
    Adam

    I guess I don't follow you when you say you have to use regexs, since you provide a regex to split().
    Do you mean you can only use Pattern and matches(), etc?
    I'm just curious now, since it looks like Sabre150 provided a solution to your problem.

  • How can I have a #defined  in Java?

    How can I have a #defined in Java that
    works like C/C++?
    Edited by: thunderball1234 on Mar 25, 2009 7:55 AM

    BigDaddyLoveHandles wrote:
    I just threw up in my mouth a little. Why do you want to preprocess Java files?I have some code that works with primitive arrays and I want to use that code for byte, char, double, float and long. I first wrote this as a file to be processed by cpp, I then changed to use perl and now I use XSLT.
    What is interesting to me is that the perl version was easiest to write and easiest to maintain. The XSLT version is bloody difficult to understand.
    Edited by: sabre150 on Mar 25, 2009 4:03 PM

  • How to get the meaning of the regular expression?

    Hello All,
    I want to know how to get the meaning of the regular expression?
    The requirement is i need to get the regular expression for some of the attributes and if the value is not matching with that regular expression then i need to give the popup saying the limitation of the attribute. but i need to give the pop up with the user understanding format.
    Like "please give a to z or 1 to 9" like that.
    So is there any way Java will help me to get the meaning of the regular expression?
    Thank You!
    Arun S

    I'm not aware of any such tool or library.
    Also, it would be a terrible "explanation", because regular expressions (similar to other programming languages) have their own "style" of defining what to enter and that usually doesn't translate well into natural language.
    For example the regex "[a-z][a-z0-9]*\s+[a-z0-9]+" could be translated as "a to z, followed by zero or more characters from a to z or 0 to 9 followed by any amount of whitespace followed by one or more characters from a to z or 0 to 9".
    Or you could simply say "Please enter two alphanumeric words, the first one must not start with a number".
    My suggestion: store/configure the human-readable description together with the regex. Don't try to automate it.

  • How do I have photos in iPhoto display on their face the date and time?

    How do I have photos in iPhoto display on their face the date and time? Displaying in the camera shows this. When I check edit the info is there. How do I have that displayed on the face of the photo when I view it in iPhoto?

    How do I have photos in iPhoto display on their face
    the date and time? Displaying in the camera shows
    this. When I check edit the info is there. How do I
    have that displayed on the face of the photo when I
    view it in iPhoto?
    Hi! My name is Tom from San Diego, CA. I have the exact same question as you. That is, I would like to be able to print out a photo from iphoto with the date that picture was taken displayed on the face of it. In this way, someone looking at that picture in a photo album years later would know when it was taken. Did you ever find a method to print copies of photos out of iphoto with the date displayed on the print? Thanks for your help!

  • Hello. I am owner of an iPod Touch 5gen. I have an error "iTunes was unable to load provider data from sync services". I tried: All Apple's tutorials including reseting sync data, reinstalling and deleting all of iTunes components including deleting it fr

    Hello. I am owner of an iPod Touch 5gen. I have an error "iTunes was unable to load provider data from sync services". I tried: All Apple's tutorials including reseting sync data, reinstalling and deleting all of iTunes components including deleting it from system registry. My system is Windows 7 64bit.

    UPDATE: The true error is : '
    "itunes was unable to load data class information from sync services"
    Any of the topics didnt work.
    Sync on my wife's laptop works.

  • How to insert data from file into matlab script node

    I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to transformed data from File to DB but the data to be insert two tables  parallel?

    Hi friends ,I am new to Oracle SOA ,I have one requirement  for the project
    actually in these project
    1.I have to read three different types of files (Employee info,Purchase Order Info,Salaes Order Info) through file adapter these records are to be store in  data base 
    transaction table.In these transaction table contains WHO columns and payload  with clob data type which contains each  record  in xml form.
    2. Now I have to  take these payload data  which is in xml form and store   in the respective table(employee or PO or SO) .I have to call these in dynamically.
    so please give me ideas and suggesstions ,,
    thanks in advance

    Roger,
    I don't know about simple way to load data from file into a table using button from your application,
    Maybe some piece of PL/SQL code with UTL_FILE or DBMS_LOB, or you can try to upload file to database using Apex "File browse" item, and then do some processing with DBMS_LOB... but it will require some work...
    Maybe someone else could advice with some simple method I don't know...
    However loading files using Apex Load Utility is quite easy.
    You can use something like this to load data to views created on remote tables:
    CREATE TABLE local_tmp_table AS SELECT * FROM view_on_remote_table WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO view_on_remote_table SELECT * FROM local_tmp_table;
    COMMIT;
    DROP local_tmp_table;Or without views:
    CREATE TABLE local_tmp_table AS SELECT * FROM remote_table@dblink WHERE 1=0;
    --load data from file to created table using Apex Load utility
    INSERT INTO remote_table@dblink SELECT * FROM local_tmp_table;
    DROP local_tmp_table;Regards
    Tomasz
    Message was edited by:
    Tomasz K.

  • How can I link specific cells in two different speadsheets so the data from a specific cell in spreadsheet A automatically updates in a specific cell in spreadsheet B. It works in Xcel- Any ideas?

    How can I link specific cells in two different tables so the data from a specific cell in table A automatically updates in a specific cell in table B? It works in Xcel- Any ideas?

    (1) your title ask the way to link different spreadsheets.
    In Numberland, a spreadsheet is an entire document.
    There is no way to link different documents.
    (2) in the message, you ask the way to link different tables.
    This feature is available and is described in iWork Formulas and Functions User Guide (which is available for free from the Help menu).
    Getting the info just requires a simple search in this available resource !
    Yvan KOENIG (VALLAURIS, France) 14 mai 2011 10:37:50

  • I have the iPad 2 and having difficulties accessing my data from my Dropbox app

    I have the iPad 2 and having difficulties accessing my data from my Dropbox app to forward to another source,tried every setting nothing works can any one assist please?

    You need to explain exactly what you are trying to do.
    Tap on a document, photo, file or whatever in the DropBox app and then tap the square with the arrow that points upward in order to send the item to another app or to email it.

  • How to define a regular expression using  regular expressions

    Hi,
    I am looking for some regular expression pattern which will identify a regular expression.
    Also, is it possible to know how does the compile method of Pattern class in java.util.regex package work when it is given a String containing a regex. ie. is there any mechanism to validate regular expression using regular expression pattern.
    Regards,
    Abhisek

    I am looking for some regular expression pattern which will identify a regular
    expression. Also, is it possible to know how does the compile method of
    Pattern class in java.util.regex package work when it is given a String
    containing a regex. ie. is there any mechanism to validate regular
    expression using regular expression pattern.It is impossble to recognize an (in)valid regular expression string using a
    regular expression. Google for 'pumping lemma' for a formal proof.
    kind regards,
    Jos

  • How to get mathched amount in a regular expression?

    Is there any direct method to know the matched amount in a regular expression? I don't know but have to loop for the Matcher object and count. Too inconvenient !
    thanks.

    sabre150 wrote:
    fxbird2 wrote:
    Is there any direct method to know the matched amount in a regular expression? Define please. Do you mean a 'group' ?
    I don't know but have to loop for the Matcher object and count. Too inconvenient !Since I don't understand what you mean by "the matched amount" I can't tell if this is correct or not.
    You could always produce an SSCCE and ask how it might be improved.No,no,no, just means matched substring, like 2 is the matched amount for "aaabbaa" by "aa".

  • How to use regular expressions to generate test data ?

    Hi
    Someone can help me on what I have to do in order to create test data with regular expressions ?
    For example, I want to introduce a random telephone number (XXX-XXXX) in the phone number Form Field, I want to create the phone number using regular expressions in order to test different values in each playback of the script.
    I don't want to use VB or vbscript in e-tester, I'm just trying to do this with e-load nav editor and e-load
    Thanks a lot

    Hi and thanks for your answer!, it's a great trick ^_^
    I'm doing a research on how to improve the execution speed of the scripts in e-load, so actually I'm trying to avoid the use of databanks and VB code also.
    I was expecting that maybe e-load, e-load nav editor or e-tester can automatically generate test data via Regular Expressions. Someone Knows if this is possible ?
    Also can anyone tell me what the option "Automatically Generated (complex)" means ? I think that this will help me a lot
    *you can find this option in e-load Nav Editor when you select a parameter in the tree view, then go to the  "type" listbox in the properties pane, there you will find this option and some more options like :"Databanked variable", "Custom Dynamic Value", "Function".. etc.
    Thanks again

  • How can I have an instance of mx.controls.List in a SWF from Flash?

    How can I have an instance of mx.controls.List component in a Flash, and import its SWF into a Flex application so it can controll it?  Is it possible to do this either at author-time or runtime?
    I see plenty of examples of how you can import a SWC into Flex, but how can I have my Flash interface, with Flex components already in place to be consumed by Flex?
    Thanks

    Hallo, here is more code for my problem:
    class Login {
       Devisen dev=new Devisen();
    class Devisen {
       JTextField field2;
       if (!Check.check_field2()) return; // if value not okay than return
    class Check {
       public static void check_field2()
         HOW TO GET THE CONTENT OF field2 HERE ?
    One solution ist to give the instance to the static function, with the keyword "this"
    if (!Check.check_field2(this)) return;and get the instance
    public static void check_field2(Devisen dev)BUT is that a problem for memory to give every method an instance of the class ? I have 50 fields to control and I dont want do give every check_method an instance of Devisen, if this is a problem for performance.
    Or do I only give the place where the existing instance is.
    Hmm...?
    Thank you Wolfgang

Maybe you are looking for

  • Would using Boot Camp be risky, in my case?

    So I have an iMac 8,1 (2008) I think it's 20 inch and I only have 1 GB ram... There are a few games I'd like to play but they can only be played on Windows XP. I watched a few tutorials on youtube but I'm not sure if I should do it, since my iMac is

  • Powerbook G3 Display Issue

    Dear Forum Mac Guru's, I know this has been asked a few times before but I thought all the comments I've read so far have not been quite my situation. So here I go... I was wondering if you are able to help diagnose a problem I am having with my Pism

  • Reinstalling Leopard without removing or changing windows partition

    I am giving my mom my iMac and I would like to remove all my files and applications, I think the best way to do this is to reinstall Leopard but I need to keep the windows partition intact. The problem is that I no longer have the Windows install dis

  • Outlook 2013-Calendar Access issue(Permission)

    Dear Support, i'm facing a problem with outlook 2013. my exchange server is 2010 and i have lots of clients using MS Office 2007,2010 and 2013. from Outlook 2010 and 2007 i can not open a calendar of any other user without their permission with shari

  • Does Bridge 5.1 support RAW files from Nikon D600 ?

    Does Bridge version  5.1 support RAW files from Nikon D600 ? latest available Camera Raw plugin 6.7 does not seem to recognize NEF fileds from D600