regex - How to match any characters except a set of contiguous characters? -


I am trying to match all the letters of the character until the pattern A0343443 ( A [0- 9] + )

Input:

  A546454: This and that happened in C: \ user \ John \ document \ folder in a file reading B546454 An error occurred: It happened in C: \ User \ John \ Documents \ folder There was an error reading the file A595949: C: \ user \ John \ document \ ....   

Desired output:

  A546454: this and more There was an error in reading: \ user \ John \ document \ folder file A595949: This is the second thing in C: \ user \ John \ document \ ....   

Because the line ending is uncertain, I want to finish when I'm positive for reaching <0 >> [0- 9] + or B [0- 9] + Saw:

  ^ (? A [0- 9] +)   

but it fails in the first capital A

i.e. the the very essence of chocolate to prevent it.

Any thoughts?

Thanks

Since your lines are A or < Code> b , you can use a negative lookhead .

  ^ (?! B [0-9] +). $$   

View

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -