Regular Expression for multiline response from a device

Hi,
I am trying to have a regular expression in java for a response (example response is )
Freq Table Info:
# freqs = 12
# trackers = 1 (LF), 1 (HF)
fmin = 300000 Hz
fsplit = 7000000 Hz
fmax = 150000000 Hz
updates = 1
Freq Table:
Slot | Mode | Description
-----|------|---------------------------------------------------------
0 | FUND | 400000 ( 400000
1 | FUND | 13560000 ( 13560000) Hz, tracking = True
Need to match this response and extract 400000 and 1356000 , stuck at mot being able to match the response. I tried [\\w]+[\\W]+ as well as \\w , dont think they work well enough, also tried testing on http://www.iowacomputergurus.com/free-products/regular-expression-tester.aspx, dont think am on the money yet. Can somebody please give any pointers or suggestions.
Thanks for your time.

PaddyK54 wrote:
Hi,
I am trying to have a regular expression in java for a response (example response is )
Freq Table Info:               
# freqs    =  12                
# trackers =   1 (LF),   1 (HF)                               
fmin       =     300000 Hz                          
fsplit     =    7000000 Hz                          
fmax       =  150000000 Hz                          
updates    =          1                       
Freq Table:          
Slot | Mode | Description                         
-----|------|---------------------------------------------------------                                                                      
0  | FUND |     400000 (    400000                                  
1  | FUND |   13560000 (  13560000) Hz, tracking = True       Need to match this response and extract 400000 and 1356000 , Well, given that input, your matches both are:
- made of two or more digits,
- followed by one or more spaces,
- followed by an opening parentheses.
So the regex \d{2,}(?=\s+\()would uniquely identify 400000 and 1356000 (with the example input you posted, which I know little about!). For all I know, other input may have opening parenthesis on other location in your string, which will break the regex.
For example, what if the following line occurs in your input:
# trackers = 123456 (LF), 1 (HF)
You see how that breaks my suggested regex?

Similar Messages

  • Regular expression for http response/request

    Hi. I need to use reg. ex. to parse a file that contains a list of http requests and responses. The requests and responses may or may not include a message body. My regular expression to detect a response is as follows:
    RESPONSE_STATUS_LINE_REG_EX + CRLF +
    "(" + HTTP_HEADER_REG_EX + CRLF + ")*" + CRLF +
    "(?s:.(?!" + "(" + RESPONSE_STATUS_LINE_REG_EX + ")" + "|" + "(" + REQUEST_LINE_REG_EX + ")" + "))*";
    The first two lines works perfectly to detect the response initial line and headers. The last line reads the message body, but does not work when the response has an empty message body. My logic is to read everything after the headers until the next response or request. This logic works when there is a message body.
    As a result, the above reg. ex. produce the following result as one response, but should be two separate responses.
    HTTP/1.0 200 OK
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
    Referer: http://www.google.com/
    Accept-Language: en-us
    HTTP/1.0 200 OK
    Connection: Close
    Date: Tue, 15 Apr 2003 23:36:09 GMT
    Cache-control: private
    Content-type: text/html
    Server: GWS/2.0
    <html><head><meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8"><title>Google Search: burger </html>
    Can anyone see what is wrong with my regular expression?
    thanks,
    Paul

    It would help if we could see the actual regexes instead of those variable names. But you might try this:RESPONSE_STATUS_LINE_REG_EX + CRLF +
    "(" + HTTP_HEADER_REG_EX + CRLF + ")*" + CRLF +
    "(?:(?!(" + RESPONSE_STATUS_LINE_REG_EX + ")|(" + REQUEST_LINE_REG_EX + ")).*" + CRLF + ")*";This way, the negative lookahead is appied at the beginning of each line, then the whole line is consumed. Without knowing more, I can't tell if this will do what you want, but at least it should fail more efficiently. :P

  • I have followed the suggested methods of restoring my iphone by placing it into recovory mode, however itunes keeps asking for a response from my iphone except it is disabled

    i have followed the suggested methods of restoring my iphone by placing it into recovory mode, however itunes keeps asking for a response from my iphone except it is disabled and thus the restoration willnot continue

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

  • Using regular expressions for validation in i18n

    Can we use regular expressions for validation of inputs in a java application taking care of i18N aspects too. Zip code for different locales are different. Can we use regular expressions to validate zipcode inputs from different locales

    hi,
    For that shall i have to create individual patterns for matching the inputs from different locales or a single pattern will do in the case of validating phone nos. around the world, zip codes etc. In case different patterns are required, programmer should have a konwledge of difference in patters for different locales.
    regards
    sdas

  • Regular expression for LOV?

    I have a list of strings in an LOV. I tried filtering it by typing in "^disk" in the search bar, which I hope will return a list of strings starting with "disk", but I failed.
    Any idea on how to use regular expression for LOVs? Thanks!

    HI Buffalo,
    i have a select list item in my page1 named :P1_EMPNAME with lov query value
    select ename as d, ename as r from emp WHERE EGEXP_LIKE(ename,:P1_SEARCH) or :P1_SEARCH IS NULL
    i have a Search text box in my page1 name :P1_SEARCH
    When i run the page, by default all the empnames will display in the lov list item
    i have given ^buffalo in the text seach item and clicked the submit button ,it shows the Employee buffalo in my list item lov.
    If you want all the entries that start with S, search for ^s
    End with R, use r$
    please try this link http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28424/adfns_regexp.htm
    Thanks
    Logaa

  • Regular expression for recognizing all tables in a sql statement

    Hi all
    I need a regular expression for recognizing all the tables bane in a geberic statement.
    Unlikely i need a regular expression that manage also inner join .I 'm sorry but this matter is new for me and i cannot find any usefull help in the web.
    Regards

    If you insist it should be something like:
    "SELECT ([A-Z0-9_]+)[.][A-Z0-9_]+(,([A-Z0-9_]+)[.][A-Z0-9_]+)* FROM (([A-Z0-9_]+)[.][A-Z0-9_]+) INNER JOIN (([A-Z0-9_]+)[.][A-Z0-9_]+) ON .+" plus spaces etc... Yes it's for this kind of statements only.
    But SQL parser is better because anyway you'll need to at least remove duplicates from founded names...

  • Request some help, over procedure's performance uses regular expressions for its functinality

    Hi All,
            Below is the procedure, having functionalities of populating two tables. For first table, its a simple insertion process but for second table, we need to break the soruce record as per business requirement and then insert into the table. [Have used regular expressions for that]
            Procedure works fine but it takes around 23 mins for processing 1mm of rows.
            Since this procedure would be used, parallely by different ETL processes, so append hint is not recommended.
            Is there any ways to improve its performance, or any suggestion if my approach is not optimized?  Thanks for all help in advance.
    CREATE OR REPLACE PROCEDURE SONARDBO.PRC_PROCESS_EXCEPTIONS_LOGS_TT
         P_PROCESS_ID       IN        NUMBER, 
         P_FEED_ID          IN        NUMBER,
         P_TABLE_NAME       IN        VARCHAR2,
         P_FEED_RECORD      IN        VARCHAR2,
         P_EXCEPTION_RECORD IN        VARCHAR2
        IS
        PRAGMA AUTONOMOUS_TRANSACTION;
        V_EXCEPTION_LOG_ID     EXCEPTION_LOG.EXCEPTION_LOG_ID%TYPE;
        BEGIN
        V_EXCEPTION_LOG_ID :=EXCEPTION_LOG_SEQ.NEXTVAL;
             INSERT INTO SONARDBO.EXCEPTION_LOG
                 EXCEPTION_LOG_ID, PROCESS_DATE, PROCESS_ID,EXCEPTION_CODE,FEED_ID,SP_NAME
                ,ATTRIBUTE_NAME,TABLE_NAME,EXCEPTION_RECORD
                ,DATA_STRUCTURE
                ,CREATED_BY,CREATED_TS
             VALUES           
             (   V_EXCEPTION_LOG_ID
                ,TRUNC(SYSDATE)
                ,P_PROCESS_ID
                ,'N/A'
                ,P_FEED_ID
                ,NULL 
                ,NULL
                ,P_TABLE_NAME
                ,P_FEED_RECORD
                ,NULL
                ,USER
                ,SYSDATE  
            INSERT INTO EXCEPTION_ATTR_LOG
                EXCEPTION_ATTR_ID,EXCEPTION_LOG_ID,EXCEPTION_CODE,ATTRIBUTE_NAME,SP_NAME,TABLE_NAME,CREATED_BY,CREATED_TS,ATTRIBUTE_VALUE
            SELECT
                EXCEPTION_ATTR_LOG_SEQ.NEXTVAL          EXCEPTION_ATTR_ID
                ,V_EXCEPTION_LOG_ID                     EXCEPTION_LOG_ID
                ,REGEXP_SUBSTR(str,'[^|]*',1,1)         EXCEPTION_CODE
                ,REGEXP_SUBSTR(str,'[^|]+',1,2)         ATTRIBUTE_NAME
                ,'N/A'                                  SP_NAME    
                ,p_table_name
                ,USER
                ,SYSDATE
                ,REGEXP_SUBSTR(str,'[^|]+',1,3)         ATTRIBUTE_VALUE
            FROM
            SELECT
                 REGEXP_SUBSTR(P_EXCEPTION_RECORD, '([^^])+', 1,t2.COLUMN_VALUE) str
            FROM
                DUAL t1 CROSS JOIN
                        TABLE
                            CAST
                                MULTISET
                                    SELECT LEVEL
                                    FROM DUAL
                                    CONNECT BY LEVEL <= REGEXP_COUNT(P_EXCEPTION_RECORD, '([^^])+')
                                AS SYS.odciNumberList
                        ) t2
            WHERE REGEXP_SUBSTR(str,'[^|]*',1,1) IS NOT NULL
            COMMIT;
           EXCEPTION
             WHEN OTHERS THEN
             ROLLBACK;
             RAISE;
        END;
    Many Thanks,
    Arpit

    Regex's are known to be CPU intensive specially when dealing with large number of rows.
    If you have to reduce the processing time, you need to tune the Select statements.
    One suggested change could be to change the following query
    SELECT
                 REGEXP_SUBSTR(P_EXCEPTION_RECORD, '([^^])+', 1,t2.COLUMN_VALUE) str
            FROM
                DUAL t1 CROSS JOIN
                        TABLE
                            CAST
                                MULTISET
                                    SELECT LEVEL
                                    FROM DUAL
                                    CONNECT BY LEVEL <= REGEXP_COUNT(P_EXCEPTION_RECORD, '([^^])+')
                                AS SYS.odciNumberList
                        ) t2
    to
    SELECT REGEXP_SUBSTR(P_EXCEPTION_RECORD, '([^^])+', 1,level) str
    FROM DUAL
    CONNECT BY LEVEL <= REGEXP_COUNT(P_EXCEPTION_RECORD, '([^^])+')
    Before looking for any performance benefit, you need to ensure that this does not change your output.
    How many substrings are you expecting in the P_EXCEPTION_RECORD? If less than 5, it will be better to opt for SUBSTR and INSTR combination as it might work well with the number of records you are working with. Only trouble is, you will have to write different SUBSTR and INSTR statements for each column to be fetched.
    How are you calling this procedure? Is it not possible to work with Collections? Delimited strings are not a very good option as it requires splitting of the data every time you need to refer to.

  • What is regular expression for cheking a set operation

    I want a regular expression for checking the syntax of the set operation given as input
    ex:
    the input should be
    [1,2,3]+[2,3] or [1,2]-[2] or [1,2,3]*[1,2]
    is should check the square bracket and the operator between two set operands

    I think you should code that from scratch. When you validate input, you usually want to tell the user what they did wrong, but a regex will only tell you whether it matches or not.

  • CCP related: A timeout occured waiting for a response from the ECU

    Hello All,
                I had just started using ECU Calibration tool kit software. Iam using USB 8473 for my application.When I tried to run the VI after loading the *.A2L file, I see an error message saying "A timeout occured waiting for a response from the ECU ". Does anyone know how to communicate with the ECU through CCP.
            Iam pretty sure that Iam using the right cable. I also checked the address of the parameters using Get property.vi what iam trying to read, wether they are matching with the address in the *.A2L file or not.They are matching. However I was able to communicate with my ECU when I use the same device to read the data over J1939 data link, based on arbitration ID's, with the Vi's from CAN Frame to Channel Conversion Library.
        Can any pls help me out how to communicate with my ECU using CAN Calibration Toolkit software.
    -Lucky.

    Hello,
              I am sending you an attachment of the manual for the ECU Calibration tool kit . Please go through the manual it will clarify your doubt. Moreover , check for can vi's in the example finder in labVIEW. Those will help ....
    I am sending you a link which gives you some insight about the installation of  CCP command set and the use of the toolkit with the USB CAN hardware.
    http://digital.ni.com/softlib.nsf/websearch/D7DE248D07CAD00086256ED3004BAB8A?opendocument&node=13206...
    Drivers and Updates: ECU Measurement and Calibration Toolkit 2.1
    Attachments:
    can manual.pdf ‏1437 KB

  • Firefox freezes about five seconds after I open it, and whenever I use Ctrl+alt+delete to close it I get told that it is waiting for a response from me.

    I am having a problem with Firefox. Whenever I open it, it runs fine for about five seconds and then freezes. A small white rectangle appears in the upper left corner of the browser window. The screen still scrolls fine, but whenever I try clicking on anything (including the menus in the toolbar), it just gives me an unresponsive 'ding' sound. When I try closing the programme with Ctrl+alt+delete, I get a message saying 'The system cannot end this programme as it is waiting for a response from you'. I originally had this problem with an earlier version of Firefox and tried installing Firefox 4 to see if this helped. It worked for two days and began doing it again. I have already tried un- and re-installing Firefox and restarting my computer, and Firefox will not run properly for long enough to let me disable any add-ons or plug-ins. What can I do to fix this?
    I've added a couple of screencaps of the problem. (or tried to)
    [http://i53.tinypic.com/161hvh2.jpg The white rectangle]
    [http://i51.tinypic.com/dwsq1.png Error message]

    Have also since found out that to start FF4 in safe mode you just hold shift whilst double-clicking the icon. We only find these things out after the event, murphy's law!

  • Wat should be the regular expression for string MT940_UB_*.txt to be used in SFTP sender channel in PI 7.31 ??

    Hi All,
    What should be the regular expression for string MT940_UB_*.txt and MT940_MB_*.txt to be used as filename inSFTP sender channel in PI 7.31 ??
    If any one has any idea on this please let me know.
    Thanks
    Neha

    Hi All,
    None of the file names suggested is working.
    I have tried using - MT940_MB_*\.txt , MT940_MB_*.*txt , MT940*.txt
    None of them is able to pick this filename - MT940_MB_20142204060823_1.txt
    Currently I am using generic regular expression which picks all .txt files. - ([^\s]+(\.(txt))$)
    Let me know ur suggestion on this.
    Thanks
    Neha Verma

  • Still waiting for a response from Adobe regarding the post "Printing a pdf from a marked-up pdf".

    Still waiting for a response from Adobe regarding the post "Printing a pdf from a marked-up pdf" dated 15 Dec 2012 9:20 AM.

    Look everyone that comes here with a support problems has gone through all the normal channels, around and  round in circles with no one seeming to be interested. They've called every phone number, every email address they can find. They have been put on hold and bounced fifty times to another operator only to be hung up on. If Adobe would bring back support to main land and have people that know what's going on instead of having people that people can barely understand read from scripts. Scripted information only applies about 10 % of the time. I'm just giving people an alternative. after they have torn their hair out going the normal route.  If they had been able to get a solution they wouldn't be coming here for help.
    There should be a forum set up just for people to air these issues and Adobe employees forced to man it. Then we wouldn't have to have such a Bad attitude. Right now Adobe's Support reputation is worse than Intuit's which did have the absolutely worse on the Planet. Now they are number 2.
    You know it yourself that Adobe's support is absolutely worse than terible. However to prevent me from being banned from the forums I will simply will provide the adobecare email address from now on
    So let's sweep it under the rug.

  • How to form a regular expression for matching the xml tag?

    hi i wanted to find the and match the xml tag for that i required to write the regex.
    for exmple i have a string[] str={"<data>abc</data>"};
    i want this string has to be splitted like this <data>, abc and </data>. so that i can read the splitted string value.
    the above is for a small excercise but the tagname and value can be of combination of chars/digits/spl symbols like wise.
    so please help me to write the regular expression for the above requirement

    your suggestion is most appreciable if u can give the startup like how to do this. which parser is to be used and stuff like that

  • Regular Expression for a Person's Name

    Hi,
    I am using the org.apache.regexp package and trying to find the regular expression for a person's name. It allows only the alphabetic string.
    I tried [a-zA-Z]+. But this also accepts the thing like "BUSH88", which is not what I want...
    Can anybody help me figure this out?
    Thanks in advance,
    Tong

    Hi,
    I am using the org.apache.regexp package and trying to
    find the regular expression for a person's name. It
    allows only the alphabetic string.
    I tried [a-zA-Z]+. But this also accepts the thing
    like "BUSH88", which is not what I want...
    Can anybody help me figure this out?
    Thanks in advance,
    Tongtry this:
    ^[a-zA-Z]+$
    the ^ represents the start of the String and the $ represents the end.
    So the expression is saying: "between the beginning and the end of the String there will only be alphbetical characters"

  • How to write the regular expression for Square brackets?

    Hi,
    I want regular expression for the [] ‘Square brackets’.
    I have tried to insert in the below code but the expression not validate the [] square brackets.
    If anyone knows please help me how to write the regular expression for ‘[]’ Square brackets.
    private static final Pattern DESC_PATTERN = Pattern.compile("({1}[a-zA-Z])" +"([a-zA-Z0-9\\s.,_():}{/&#-]+)$");Thanks
    Raghav

    Since square brackets are meta characters in regex they need to be escaped when they need to be used as regular characters so prefix them with \\ (the escape character).

Maybe you are looking for

  • Last 5 days rolling

    Dear all, I have created a report which calculates the averages for Month to date, year to date, last full working days week and last 4 working days week. Now I would like to add another feature which is going to show me the records of last 5 rolling

  • Standard Manager Not Picking Up Request

    Hi , Standard Manager is not picking up the requests.All the request remains in Pending Normal State. If I exclude the same request and assign it to another Manager , It is running successfully. Note Read/Followed : 555081.1,1304305.1,144921.1 ,15814

  • How to customize those 9 default flash skins?

    Hi all, I have been going absolutely crazy trying to change the control bar at the bottom of a flash player. All I want to do is to create a cool slim black controller bar. I tried several free players such as  Wimpy Wasp, RAVE, JW PLAYER, etc..  Eve

  • How to do AUC scenario without Internal Orders concept?

    HI, I need to do AUC scenario without using Internal Order concept. Kindly tell me the Process flow for it. It would be a great help for me if anyone can gives the Inputs.. Thanks Kishore

  • Would BT accept the service we get?

    Internet died at about 11pm on 02/10. Running troubleshooting via Hub Manager the following morning reported a DSL issue. Checked the phone line and got a lot of white noise and then nothing - line is now completely dead. Rang the 03301234151 number