regex - JavaScript regexp select only last occurrence -


select last occurrence

i'm trying select last word (until space), come after last white space , @ character.

following string

hello hi @why helo @blow @name             // capture: name hello hi @why helo @blow name@name         // capture: blow 

and string

@blow not know how resolve         // capture: blow 

here last occurrence first word blow, select @ after word (obviously whitespace not in first word).

i tryed this: https://regex101.com/r/pg1ku1/1

simplest answer:

/\b@[^@]\w*(?!.*?\s@)/ 

see demo


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -