opendatasicilia / tansignari

"T'ansignari e t'appeddiri"
http://tansignari.opendatasicilia.it
Creative Commons Attribution 4.0 International
18 stars 10 forks source link

[regex] caratteri di troppo #230

Closed pigreco closed 1 year ago

pigreco commented 1 year ago

Ho dei testi come sotto:

PdCC|sn18|qwerty
PdCC|18|wandrea

con questo (sotto) acchiappo sempre i caratteri prima del numero 18

(.+)\|(.+\d+)\|(.+)

come posso ottenere PdCC 18 in entrambi i casi usando unico pattern regex?

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

pigreco commented 1 year ago

TROVATO

(.+)\|[a-z]{0,2}(\d+)\|(.+)

restituisce sempre : PdCC 18 https://regex101.com/r/G09u5H/1