July 16th, 2013, 07:39 PM
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.
July 16th, 2013, 08:15 PM
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.
July 17th, 2013, 08:56 AM
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.
July 17th, 2013, 02:55 PM
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.
Originally Posted by RodrigoAC
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