Questions tagged [preg-match-all]

A PHP function that performs a global regular expression match using PCRE patterns.

A PHP function that performs a global regular expression match using PCRE patterns.

int preg_match_all ( 
     string $pattern , 
     string $subject 
     [, array &$matches 
     [, int $flags = PREG_PATTERN_ORDER 
     [, int $offset = 0 ]]] 
)

preg_match_all() in the PHP Manual

1934 questions
0
votes
1 answer

A quick way to preg_match a utf-8 string

$input = "žąsis su šešiolika žąsyčių"; preg_match_all("/\b(žąs\S*)/iu", $input, $output_array); print_r($output_array); returns a one big nothing. I want it to return both "žąsis" and "žąsyčių". Seems to be a simple problem but I can't find a…
August
  • 490
  • 3
  • 5
  • 18
0
votes
1 answer

Parsing the name of multidimensionnal array

I'm using PHP to try to parse a string matching this kind of pattern : field[foo][bar] I use preg_match_all to get the indexes of the array ('foo' and 'bar' in this case). Here is my code, but it does not work : preg_match_all("/\w+(\[(\w*)\])*/",…
Angelo
  • 198
  • 1
  • 14
0
votes
1 answer

coding Regex in PHP

I have a regex pattern that filters out some specific values. I tried running the pattern in PHP but it always returns NULL for values. $re1='^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*?"(.*?/p/.*?,\d+,(\d+).*?)" "(\d+)" "(\d+)".*$'; preg_match($re1,…
Naveen Gamage
  • 1,844
  • 12
  • 32
  • 51
0
votes
2 answers

I want to grab href address which has class link

[a href="http://www.vanchosun.com/m/market_index.php?view=market"]11[/a] [a href="test.php?view=test&cate=buysell&testid=100" class="link"]22[/a] How to grab href which has class link using php preg_match_all Thanks.
user1736363
  • 69
  • 1
  • 8
0
votes
1 answer

RegEx, preg_match_all and filter domains

For several hours I'm trying to ride my fair one script and end up almost ready, but it gets weird problem. Attach a piece of code to get an idea what I mean. $sep = '\.com|\.tv'; $string = 'sub.sub2.sub3.tv-bole-el.com'; $pat =…
0
votes
1 answer

PHP match content

I have following $content string. I has title and optionally the icon values also. I want to get all the values of titles, but I want to check there is an icon for that title, then I want to get that also. I can get all titles using the…
user2738640
  • 1,207
  • 8
  • 23
  • 34
0
votes
4 answers

Matching usernames in a memberlist using regex

On a phpBB forum, memberlist.php lists all the members of the board with the following HTML: Username Where u=4 is the UserID of the user, and Username is obviously their username. There are…
Matt
  • 1,083
  • 2
  • 10
  • 15
0
votes
3 answers

Scrape longitude and latitude from this html using preg_match

I'm trying to use a regex to extract just the longitude and latitude coordinates from this html. This is just a snippet of the full html from http://www.bricodepot.fr/troyes/store/storeDetails.jsp?storeId=1753 so I need to be able to search through…
Ben Paton
  • 1,432
  • 9
  • 35
  • 59
0
votes
3 answers

How to get data betwen using preg match all?

i am trying to get data between two that has specific color #ff0000 using the following code but i getting no data! could any one tell me what i am doing wrong ? example of data: get this text1
user1788736
  • 2,727
  • 20
  • 66
  • 110
0
votes
1 answer

Preg_match string and put matches into an array

i'm creating a photo sharing system with a particular photo temp verify. Basically, on input file submit photos are loaded into a dir called "temp". I change the name of file in a particular string like this 3_1383310890_1709373616.jpg where 3 is…
Mario Rossi
  • 59
  • 1
  • 11
0
votes
1 answer

Web spider on prices

I would like to compare certain products by price on a couple of websites. So I can create a price history for myself before buying a product. If the price stays stable, I usually order the product, if not I go and ask questions why the price keeps…
gelleby
  • 108
  • 8
0
votes
2 answers

Catching ids and its values from a string with preg_match

I was wondering how can I create preg_match for catching: id=4 4 being any number and how can I search for the above example in a string? If this is could be correct /^id=[0-9]/, the reason why I'm asking is because I'm not really good with…
user2865738
0
votes
1 answer

preg_match_all function gives me first 159 results from possible 261

I hope, someone knows, what is wrong. I made a parser to get all the Link tags. I test it on http://www.bbc.co.uk/. There are 261 of them on the page I test, and I receive only first 159. I checked it manually, I find every…
Bandydan
  • 623
  • 1
  • 8
  • 24
0
votes
1 answer

preg_match returns weird result

I need to extract text in curly braces but only if the first word within them is a "allowed" word. for example the following text: awesome text, a new line {find this braces}, {find some more} in the next line. Please {dont find} this ones. in this…
iceteea
  • 1,214
  • 3
  • 20
  • 35
0
votes
1 answer

php returned array from preg_match_all

i have an array that is being returned like this: Array ( [0] => Array ( [0] => ;3750;011; [1] => ;3750;012; [2] => ;3750;013; [3] => ;3750;014; [4] => ;3750;015; [5] => ;3750;016; [6] => ;3750;017; [7] => ;3750;018; [8] => ;3750;019; )) the array…
Fábio Linhares
  • 107
  • 1
  • 14
1 2 3
99
100