How to get word after regex matching phrase -
P粉834840856
P粉834840856 2023-09-12 09:15:32
0
1
461

I want to get the next word after the matching phrase.

wait. - I want to change my pain threshold

--"Change my ***"

let text = "I want to change my pain threshold" let firstTriggerregEx = "(?:\b|')(change my)(?:\b|')"; const found2 = text.match(firstTriggerregEx); console.log(found2);

This will return the match, but not the following word

P粉834840856
P粉834840856

reply all (1)
P粉466909449

You can use the following modes:

(?

The first part is a positive review. It ensures that the following characters/groups are preceded by the specified pattern.

The second part consists of the "word character" ([a-zA-Z0-9_]) character set in the capturing group so that you can retrieve it later.

https://regex101.com/r/CdKcVh/1

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!