javascript - Regex match certain kind of paragraph -


i have string

1 example 2 example 3 example 

where each line separated new line. trying find way match there has more 1 line, , each line must contain number followed string. there has @ least 2 lines.

this have far not working.

(\d* \w*(\n|$)){2,} 

something work you:

string.match(/\d+ \w+[\n\r]+\d+ \w+/m); 

note 'm' specifies it's okay match across multiple lines.

edit looks expression fine, missing "m".


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -