Sunday 7 July 2013

Regex to find non-quoted string match

Created a below regex to  identify , that is not quoted. 

(,) (?=(?:[^\"]|\"[^\"]*'\")*$),

(,) 
    (?=   
           (?:                               # non capturing group
                 [^\"]|                     # string not quoted 
                 \"[^\"]*'\"           # string inside quotes
            )*$                            # many a times until end of string
     )


This has a an issue when you really run it with a lengthy string
positive lookahead  + alteration +  * + lengthy string  +  heap size crunch.




So the below regex will fetch you the 

(,)(?=(?:[^"]*"[^"]*")*[^"]*$)

(,)
   (?=                            # look ahead
       (?:                         # non capturing group, ignore string within group 
           [^"]*                 # group of non-quoted text  
           "[^"]*"               # followed by quoted quote + non quoted (*)+ quote  
        )*                        # this group can be 0 or many
    [^"]*                       # capturing group    (non quoted)
   $)                            # till end of string



Regex Tester Online: http://regexpal.com/


String used to Test 
(state "locked" OR state" not active" NOT state"pending or " OR state"running" AND state" and completed" OR state"error" OR state"warning") AND NOT hidden"true" AND NOT type"Background" AND NOT cycle"true" AND parent"null" AND test"asdfasdf asdfhasd fha sdfhas udfhuasdhfu asudfhasudfhuas fhuihas udfhuashd ufhasuidfhua shdfuas hduhuhasd fuhasdufhas duhuhu hasufhuasdhfdfsdfasdfsdasdsad7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777aasda777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777sd7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777as7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777d7end")





1 comment:

  1. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost thepast 6 years, but I had no idea of solving some basic issues. I do not know how to Download Cracked Pro Softwares But thankfully, I recently visited is a website named vstflex.net
    iZotope Vinyl
    Sonarworks Reference Crack
    MacDrive Pro Crack

    ReplyDelete