regex - Javascript Regular Expressions - using * with multiple characters -
i'm parsing string looks this:
int num 1, num2, num3; //do other stuff
in betwee lines, there \r\n. i'm looking replace \r\n \n, , got working fine, howerver, i'd multiple copies of /r/n in row. in other words:
/r/n <-- found
/r/n/r/n <-- found also
/r/r/n/n/n <-- not found
here current statement:
mydata.replace (/(/r|/n)*/g, "somestuff");
do know way of how make * character apply multiple characters, repetitions of "/r/n"* rather (/r|/n)* finds either /r or /n number of times.
this:
(\r\n)+
the plus matches 1 or more times.
or this:
/(\r\n)/g
the g matches occurrences of string
depends on need or actual code, if can post it.
Comments
Post a Comment