Regex Find last word between comma -


i have : "my item1,item2,item3,item4,"

i want answer : "item4"

i use :

    (?<=\,).*(?=\,$) 

but returns me : "item2,item3,item4"

how can last ?

i know lazy sign ? , i'm not able use it.

thanks help.

use [^,]* instead of .* since . match character comma. here non-greedy form .*? won't work.

(?<=,)[^,]*(?=,$) 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -