Filter words in English articles

Source: Internet
Author: User
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\bYou can.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.