Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reg ex not to match
#1
Function Function5
In my code, i want my 4th submatch not to match "3074". could i get some help please.
Code:
Copy      Help
str pattern= F"sip4 ({sip4}) dip4 (\d*.\d*.\d*.\d*) sport (3074) dport (\d*.) timeout (\d*.)"
#2
Not tested  but maybe (^3074). Would  help more if you  included  the search string and findrx statement. Not at my pc so just a quick  guess .
#3
so my sting is not known at the start but here is what the string could look like after its extracted

Function Function5
Code:
Copy      Help
str s=
;sip4  192.168.1.2 dip4 192.168.1.3 sport 3074 dport 23763 timeout 120
;sip4  192.168.1.2 dip4 192.168.1.4 sport 3074 dport 11456 timeout 125
;sip4  192.168.1.2 dip4 192.168.1.45 sport 3074 dport 3074 timeout 129
;sip4  192.168.1.2 dip4 192.168.1.98 sport 3074 dport 230 timeout 110
ARRAY(str) a
if(findrx(s pattern 0 4 a) <1) ret
a.sort(8)
#4
(?!3074\b)(\d+)
#5
thanks both.


Forum Jump:


Users browsing this thread: 3 Guest(s)