Regex href matches the number

Well, here I am again in regular expression and about my poor understanding of this. Spent more time studying it, and here is what I came up with:

/<a href=\"travis.php?theTaco=([0-9999999])\">(.*)</a>

Basically I want a number on this line:

<a href="travis.php?theTaco=510973">510973</a>

Is my regex almost good? my original was:

"/<a href=\"travis.php?theTaco(.*)\">(.*)<\/a>/";

But sometimes he returned me huge lines. So I just want to get numbers only. I looked through other posts, but there are so many unrelated materials, please give an example, resource or link directing to a very close question.

Thank.

+3
source share
3 answers

Try using the HTML parser provided by the language you are using.

, :

[0-9999999] - , . [0-9], . , [0-9]+. .* . .*?, . , [0-9]+ .*. , , , , \1 .

, , ., ?.

Try:

<a href=\"travis\.php\?theTaco=([0-9]+)\">\1<\/a>
+4

, , [0-99999], . - [0-9] + , . , , codaddict.

+1

, , .

, , , .

/theTaco=(\d+)/

. , , .

+1

Source: https://habr.com/ru/post/1780127/


All Articles