I have a one long string with sentences, every sentence contains a number. Every sentence is separated by /X. Having a given number, how can I match and extract only the one sentence which contains that number?
"\X The animal 0000 I really dig \X Above all others is the pig. 222 \X Pigs are noble. Pigs are clever 3333, \X Pigs are 5555 courteous.\X However, Now and then, to break this 6666 rule, \X One meets 7777 a pig who is a fool. \X"
For example, I want to extract the sentence with the number 5555, to get this: " Pigs are 5555 courteous."
How to do this with JS regexp? My code matches the whole text:
str.match(/\\X.*5555.*\\X/);