RegeX in PHP to capture string

André

How do I get the following values ​​in Regex from the following string

<tr><td>4 <td><b><a href="number.php?v=41a&k=53&t=102">3</a></b>

v = 41
k = 45
t = 102

I wanted only the number of each segment (v k t)

I tried this and got only one at a time

v=\d+
Toto

If your input string is really as simple as you said, you could use preg_match_all:

$str = '<tr><td>4 <td><b><a href="number.php?v=41a&k=53&t=102">3</a></b>';
preg_match_all('/(?<=[vkt]=)\d+/', $str, $m);
print_r($m[0]);

Output:

Array
(
    [0] => 41
    [1] => 53
    [2] => 102
)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Capture string in regex replacement

From Dev

Capture string in regex replacement

From Dev

Python regex string groups capture

From Dev

Pig capture matching string with regex

From Dev

capture alphanumeric string using regex

From Dev

Trying to capture the following string with regex

From Dev

Regex - Capture string following timestamp

From Dev

PHP Regex, capture repetition matches

From Dev

PHP Regex, capture repetition matches

From Dev

Regex to capture string until another string is encountered

From Dev

How to stop a regex capture in a string with no newlines yet still capture globally?

From Dev

Python Regex capture multiple sections within string

From Dev

Ruby regex to capture any string with a number

From Dev

Regex JavaScript capture till (before) optional string

From Dev

replace regex capture a text without excepted string

From Dev

capture words from string with python regex

From Dev

difficulty in building a proper regex to capture a string

From Dev

Regex to capture date and hours along with a int on a string

From Dev

Python capture group from string, with regex

From Dev

PHP comparing a regex and a string

From Dev

php regex to split string

From Dev

Parsing this string with regex PHP

From Dev

PHP comparing a regex and a string

From Dev

How to regex string in php

From Dev

php regex string between

From Dev

PHP Regex String Exctraction

From Dev

PHP Regex for highlight string

From Dev

Regex to capture string between quotes especially when the string starts with a quote

From Dev

RegEx Match a string and capture the following string until following tag