#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Single Regex Pattern


    Hi, i need help for this necessity,

    my pattern is in this link!

    (i want to get just the parts between ZCZC ~ NNNN
    which have the string "kkkkkk", including ZCZC and NNNN)

    h t t p : / / p a s t e b i n . c o m / A R X R V 4 C c

    if someone can help me, thanks!
    i'm trying to create an regex but without success.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,648
    Rep Power
    1945
    Is the text stored in file?
    Is it formatted exactly how you have posted it?
    What language do you use for this?

    If the first two questions above is an yes, regex is not required for this.
    Most (all?) languages have function to read a file line by line.
    1. Read each line until you find a line with ZZZ
    2. When ZZZ is found, read and save all following lines
    2a. If line contains KKKK, register that it does exists.
    3. Stop when line contains NNN
    4a. If KKK exists, process the saved data as needed.
    4b. If KKK doesn't exists, repeat from 1.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0
    yes Sir, is stored in txt file.
    yes, the format is exactly as posted.
    I use php to perform this operation,

    interesting, i'll try this, thanks aparently is more simple!

    but have any difference of performance between this two methods?

    Thanks for your reply.
  6. #4
  7. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,648
    Rep Power
    1945
    Originally Posted by RodrigoAC
    but have any difference of performance between this two methods?
    Can't tell if you will notice any perfomance hit with your example, but regex is a more complex "task" compared doing a standard equal call.

    Programming is also about knowing which tools to use.
    For example, if you want to cut a paper, do you take a scissor or a chainsaw?

    Comments on this post

    • Laurent_R agrees : I fully agree.

IMN logo majestic logo threadwatch logo seochat tools logo