This is an English string {code...}. I want to write a regular expression that can be used as long as the word is used. this is what I wrote. {Code...} but cannot find the online regular expression of the first word in the article
This is an English string
When I was young,my uncle king of the jungle,one day he call me,and say we walk to the river,i asked why?my uncle say, you must learn how to cherish the water.
I want to write a regular expression that can be used as long as the word is used.
This is what I wrote.
[^a-zA-Z]young[^a-zA-Z]
However, the first word in the article cannot be found.
Online Regular expression
Reply content:
This is an English string
When I was young,my uncle king of the jungle,one day he call me,and say we walk to the river,i asked why?my uncle say, you must learn how to cherish the water.
I want to write a regular expression that can be used as long as the word is used.
This is what I wrote.
[^a-zA-Z]young[^a-zA-Z]
However, the first word in the article cannot be found.
Online Regular expression
[^a-zA-Z]
Change[^a-zA-Z]?
You can.
(^|[^a-zA-Z])you([^a-zA-Z]|$)
(^|[^a-zA-Z])When([^a-zA-Z]|$)
I think this is the case. I thought about the first word and the last word, in fact, I think the simplest way is to add a space or other special characters to the header and tail of the string, so that your original regular expression can be matched successfully.
[^a-zA-Z]
This modeMatch Non-"a to z" or "A to Z" characters, There are no characters in front of the When, and it cannot be matched. Other matching words also match a space.
If you do not want spaces, you can use escape character B to match the word boundary. this escape character can match the word boundary formed by spaces and punctuations at the beginning and end, it does not match any extra characters.
\bWhen\b
You can.