1

I need a regular expression like ([.\n]*) but that doesn't work. I have tried the s modifier also...

I want to get data from a table and the regular expression which is working in a few cases is:

~m/>(@ARGV)<\/.*\n(<td.*\n*.*\/td>\n){3}<td(.*\n*.*\n*)<\/td>/

I need to use the $3, but the number of newlines is not defined and I have no idea how could I solve this problem. Can someone please help me?

kata
  • 43
  • 1
  • 6

1 Answers1

1

I did not find ~m and @ARGV in your test string. So, I made another pattern:

<td>((?:<span.*\n*){3})</td>

REGEX 101 DEMO.

Quinn
  • 4,394
  • 2
  • 21
  • 19
  • Thanks, but the problem is that I don't know exactly the number of newlines, it can be 0 or more. I tried to write * and {0,} too instead of the {7} like you did. [here is the sample data](https://regex101.com/r/vH9tY4/3) – kata Mar 27 '16 at 18:41
  • Now the capturing group is in $1. Is that okay? – Quinn Mar 27 '16 at 20:33
  • I used a part of the original version and this one and it's okay now, thank you. – kata Mar 27 '16 at 20:43
  • I also made version 7 for unknown number of new lines. Please check if it helps – Quinn Mar 27 '16 at 20:46