ylliX - Online Advertising Network
How to build GenAI mock server?

PAse number from string by regexp


I have a several texts blocks. The text contains article and his number in different format.
the text contains several blocks and the title of the article itself with a number. There may be numbers in the text of the article, but they are not needed. I need get only article number.

For example
should be 8, 13.07.2001 not interested

 ARTICLE 8 some text form date 13.07.2001

should be 8

 ARTICLE 8. Some text 

should be 8.1

 ARTICLE 8.1. some text

should be 8-1

ARTICLE 8-1. some text 

I use the next regular expression

ARTICLE (\d+([.-]\d+)?)

But I can cath

 ARTICLE 8-1

who can hrlp with regelr expression to get Arctcle number in all cases ?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *