Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Need help

Last post 07-23-2008, 10:33 AM by ddrudik. 5 replies.
Sort Posts: Previous Next
  •  07-22-2008, 1:06 PM 44458

    Need help

    Hi All,

    I have data in the format "ERQA-DESKI-P2 STAC BOTAP D... Medium New 12.02.2008 02:42:37 08.07.2008 18:13:55 STAC Henry Bank...  516999 5000005008".

    I would like to write regular expression to extract details from above data.

    Would request you to help me out;

    Thanks. 

     

     

  •  07-22-2008, 2:32 PM 44462 in reply to 44458

    Re: Need help

    Specify what match(es) you want from the string and then explain what separates that data fields(length and/or space character etc.), also specify what platform you are using.


    looking for a new regex book?
    Regular Expressions Cookbook
  •  07-23-2008, 6:08 AM 44480 in reply to 44458

    Re: Need help

    Thank you very much for the reply.

    I am extracting data from above string using VBA.

    Extracted data should look like:

    Column A                                 Column B                        Col C             Col D                                 Col E                              Col F                             Col G

    ERQA-DESKI-P2                      STAC BOTAP D....           Medium New   12.02.2008 02:42:37           08.07.2008 18:13:55         STAC Henry Bank...      516999 5000005008

    Thanks in advance for looking into this.       

  •  07-23-2008, 6:32 AM 44484 in reply to 44480

    Re: Need help

    What separates the columns (it appears to be a single space) and what parsing rule(s) determine that words separated by single spaces are not new columns.


    looking for a new regex book?
    Regular Expressions Cookbook
  •  07-23-2008, 8:34 AM 44487 in reply to 44484

    Re: Need help

    It is the spaces and word/number pattern determines the separation of string into columns,

    For e.g. 

    ^([a-z0-9_\.\-]+)\@(([a-z0-9\-]+\.)+)([a-z]+)$
    separates valid email ID's into three column.

    I have got this reg ex from http://vbaexpress.com/kb/getarticle.php?kb_id=68

    Thanks...

  •  07-23-2008, 10:33 AM 44491 in reply to 44487

    Re: Need help

    deehem:

    It is the spaces and word/number pattern determines the separation of string into columns,

    For e.g. 

    ^([a-z0-9_\.\-]+)\@(([a-z0-9\-]+\.)+)([a-z]+)$
    separates valid email ID's into three column.

    I have got this reg ex from http://vbaexpress.com/kb/getarticle.php?kb_id=68

    Thanks...

    There's no e-mail address in your sample.  Specifically with regards to your sample:

    "ERQA-DESKI-P2 STAC BOTAP D... Medium New 12.02.2008 02:42:37 08.07.2008 18:13:55 STAC Henry Bank...  516999 5000005008".

    Explain how the columns are to be determined, there doesn't seem to be any rules for how this data should be parsed.  If I match on non-space characters:

    Raw Match Pattern:
    \S+

    $matches Array:
    (
        [0] => Array
            (
                [0] => ERQA-DESKI-P2
                [1] => STAC
                [2] => BOTAP
                [3] => D...
                [4] => Medium
                [5] => New
                [6] => 12.02.2008
                [7] => 02:42:37
                [8] => 08.07.2008
                [9] => 18:13:55
                [10] => STAC
                [11] => Henry
                [12] => Bank...
                [13] => 516999
                [14] => 5000005008
            )

    )




    looking for a new regex book?
    Regular Expressions Cookbook
View as RSS news feed in XML