Closed phgachoud closed 5 years ago
I didn't try to run your code yet, but I have two remarks/questions:
]
at the end of your regexp?l_reg.match_count >= 2
, one for the entire string, and one for the substring.I didn't try to run your code yet, but I have two remarks/questions:
* Why do you have `]` at the end of your regexp?
typo you're right, thx
* You should check `l_reg.match_count >= 2`, one for the entire string, and one for the substring.
You are right, I corrected it but am with the same problem... match_count is at 0...
I must say that I never used [:alnum:]
. Perhaps there is a bug here. Can you try to replace it with [a-zA-Z0-9]
to see if it works better?
It could be that you need to write [[:name:]]
. I think I read that once in some PCRE doc.
Mac_regex: STRING = "^([0-9]{8})_([a-zA-Z0-9]{2}[-:][a-zA-Z0-9]{2}[-:][a-zA-Z0-9]{2}[-:][a-zA-Z0-9]{2}[-:][a-zA-Z0-9]{2}[-:][a-zA-Z0-9]{2})_.*"
solved my issue, I had both a trailing ]
@ the end, and the alnum
didn't work.
Thx for your help!
Any idea why the following regex with
needle:
^[0-9]{8}_([:alnum:]{2}[-:][:alnum:]{2}[-:][:alnum:]{2}[-:][:alnum:]{2}[-:][:alnum:]{2}[-:][:alnum:]{2})_.*
haystack:
20190818_30-45-11-B4-EF-5D_192.168.0.96_inverter_data.py.csv.bz2
code: `
`
doesn't give a match_count -> captured_string(1) for the mac address??