Re: regexp match string with word1 and not word2



James Stroud ha scritto:

The P.S: suggests homework, but this can't be homework because python
regex won't do this, so your teacher gets an F if its homework. You

Not a homework, but a "workwork" :-)
I'm writing a script to parse logfiles, and I have began to study
python for this (bash was too much slow).
When i'll finishi it, I'll post a link here if someone think that
could be helpful.

require a negative look-behind assertion of variable length--not
possible in python regex. You will have to use something else--or maybe
you don't understand the homework problem.

I was asking that cause in the code i wrote this:
for y in range(0, len(skip_lst) ):
if (re.search(skip_lst[y], line)):
skip=1
break

In skip_lst there are the regexp and strings (on one line) to match
with "line".
But rarely the rules to be matched need to have also a logical And.
What could be the solution? Add another array with a "not" regexp?

.



Relevant Pages

  • Re: function to match parenthesis ( and )
    ... I do think you have created a nice debate and have some serious points. ... > prefer RegEx version if you do not need to do this check 100 000 times. ... Hence, not only do you got a cryptic regexp, you also have a cryptic comment ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Identifier like "_", "$", etc.
    ... Do not expect that to be a reliable source of ... function should be "Do not use with RegExp ... What if regex ends up as an argument of your function and that function invokes `call` on it after testing it with `typeof`? ...
    (comp.lang.javascript)
  • Re: Can Access use Fuzzy Logic - RegEx
    ... And OLE makes it easy to use VBScript's RegEx ... I, for one, have never found RegExp to be easy to understand at all. ... while VBA string handling functions are native to Access (and thus, ... expect it to be less efficient than the native VBA string handling ...
    (comp.databases.ms-access)
  • Re: [FYI] MSXML HTTP translates response status code 204 to 1223
    ... Don't you think regex is really a wrong tool for the job in this case? ... Modifying the property requires much less effort than modifying the method. ... the RegExp provides the user which much an ... Efficiency difference most definitely doesn't matter. ...
    (comp.lang.javascript)
  • Re: Change a single character in a string
    ... I already gave this regex in another branch of this tread: ... There is an overhead to the construction of a RegExp and to the ... but after that the replacement will be quick. ... 8-character strings; for a 2-character string, ...
    (comp.lang.javascript)