Home > Back-end >  About Delphi using regular expressions, processing is not taking a string at the end of the string
About Delphi using regular expressions, processing is not taking a string at the end of the string

Time:10-06

5 13 15 and 25 31 + 13
05 30 + 13 14 15 22 26
05 December 15 and 22 and 31 + 13
5 + 13 14 15 22 and 31
11 15 and 22 29 08
31 + 1305 23 24 31 + 13 14 15
05 10 15 and 25 30 + 13
05 23 26 31 + 13 14 15
5 + 13 14 15 of 23 and 27, 31
05 November 15, 23 to 28 31 + 13
05 14 15 21 29 30 + 13


Above is the data string, starting from the red to the red end, there is a space, Numbers, and newline +.

My regular: 05 \ s \ s \ d \ d \ d \ d \ d \ d \ d \ s \ s \ \ s \ d \ d \ d \ d \ d + (\ w] [\ w *?) [^ (5)]

Thought: starting from the 05 match, until the match to not from the end of a string of

Logical results:
1:
05 13 15 and 25 31 + 13
05 30 + 13 14 15 22 26
05 December 15 and 22 and 31 + 13
5 + 13 14 15 22 and 31

2:
05 23 24 31 + 13 14 15
05 10 15 and 25 30 + 13
05 23 26 31 + 13 14 15
5 + 13 14 15 of 23 and 27, 31
05 November 15, 23 to 28 31 + 13
05 30 + 13 14 15 21 29

But the result is wrong, or is the whole of the match, the ([\ \ w w] *?) Instead (] [\ w \ w *), and matching is all

Also ask the great spirit show, online, etc., give high marks!

CodePudding user response:

Didn't understand what you want the results
If it is just want to leave the euro at the beginning of the line
It can be (05). + [^ 5]

CodePudding user response:

If want to erase 08 the first line
(08). + [^ 5)

I think you don't have to put these into a string with regular again, directly in the byte array processing is not good

CodePudding user response:

He had settled, and stick

CodePudding user response:

According to your description, before the match two is ok, it is not necessary to do so many matches
  • Related