preg-match-all Questions

6

I try to get phone numbers from string in german format. But I don't get it to full run. The input text is a full HTML-Page with lots of content, not only the numbers. Possible Formats: (06442) 3...
Rabon asked 8/1, 2017 at 22:28

4

Solved

I'm trying to get the first image from each of my posts. This code below works great if I only have one image. But if I have more then one it gives me an image but not always the first. I really ...
Enfilade asked 20/9, 2011 at 3:37

4

Solved

I am trying to identify if a string has any words between double quotes using preg_match_all, however it's duplicating results and the first result has two sets of double quotes either side, where ...
Spa asked 28/10, 2014 at 10:57

6

Solved

I'm trying to get all substrings matched with a multiplier: $list = '1,2,3,4'; preg_match_all('|\d+(,\d+)*|', $list, $matches); print_r($matches); This example returns, as expected, the last mat...
Homeric asked 5/7, 2011 at 8:36

2

Solved

I'm interested in replace numeric matches in real time and manipulate them to hexadecimal. I was wonder if it's possible without using foreach loop. so iow... every thing in between : = {numeri...
Topazolite asked 5/1, 2015 at 23:23

2

Solved

let's say I have two regexp's, /eat (apple|pear)/ /I like/ and text "I like to eat apples on a rainy day, but on sunny days, I like to eat pears." What I want is to get the following indexes...
Paginate asked 16/3, 2010 at 3:18

3

Solved

Here's my string: address='St Marks Church',notes='The North East\'s premier...' The regex I'm using to grab the various parts using match_all is '/(address|notes)='(.+?)'/i' The results are:...
Snowclad asked 6/6, 2013 at 19:44

2

I'm designing a script and trying to get to the if construct without eval in php. Still incomplete but blasting through, it's to do a templating engine, the "if" part of the engine. no Assignment ...
Avenge asked 12/6, 2016 at 8:47

3

Solved

What do the preg_match() and preg_match_all() functions do and how can I use them?
Tanika asked 3/11, 2010 at 15:44

3

Solved

What does the "~" character mean in the following?: preg_match_all("~<img [^>]+>~", $inputw, $output); My guess is that they are beginning and end markers such as ^ and $.
Islamize asked 7/2, 2014 at 9:57

3

Solved

I'm using preg_match_all for very long pattern. when run the code, i got this error : Warning: preg_match_all(): Compilation failed: regular expression is too large at offset 707830 After sea...
Slider asked 25/11, 2011 at 11:43

2

Solved

I am trying to get length of images in a string. My string $page="<img><img><img><img>"; From the string above ,I want to get the output "4 images". I tried preg_match_...
Oncoming asked 25/12, 2015 at 4:37

1

Solved

I am implementing a plugin code for my CMS system. Something like a shortcode but will be applicable in many scenarios. I want a case where an admin writes his code like this: Example 1: {COMMAN...
Hudibrastic asked 21/11, 2015 at 8:13

3

Solved

having a string like this: $str = "dateto:'2015-10-07 15:05' xxxx datefrom:'2015-10-09 15:05' yyyy asdf" the desired result is: [0] => Array ( [0] => dateto:'2015-10-07 15:05' [1] =>...
Varistor asked 9/10, 2015 at 14:52

1

Solved

I need to find specific part of text in string. That text need to have: 12 characters (letters and numbers only) whole string must contains at least 3 digits 3*4 characters with spaces (ex. K9X6 ...
Angelia asked 27/6, 2015 at 9:50

2

Solved

I am using PHP on shared server to access external site via API that is returning JSON containing 2 levels of data (Level 1: Performer & Level 2: Category array inside performer). I want to con...
Hydrometer asked 27/2, 2015 at 19:33

1

Solved

I'm trying to validate queries before executing them, If query is not a mysql select statement then i have to show message to user. I found below regex from this link: Validate simple select quer...
Brolly asked 2/8, 2014 at 6:35

8

Update/Note: I think what I'm probably looking for is to get the captures of a group in PHP. Referenced: PCRE regular expressions using named pattern subroutines. (Read carefully:) I...
Lacerate asked 16/6, 2011 at 11:41

1

Solved

I want to get all video qualitys from string. My string: #EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=350000 128/prog_index.m3u8?key=49bfee85b05d117a2906368428094e94 #EXT-X-STREAM-INF:PROGRAM-...
Handout asked 16/6, 2014 at 18:0

2

Solved

I have spent over 4 hours trying to find a regex patter to my php code without luck. I have a string with html code. It has lot of urls formats like: example.com http://example.com http://www.ex...
Traject asked 5/3, 2014 at 16:1

4

Solved

It is possible to get all content in nested curly braces from string? For example: The {quick} brown fox {jumps {over the} lazy} dog So i need: quick over the jumps {over the} lazy Better ...
Crosby asked 27/4, 2013 at 23:58

4

Solved

I want to fetch text in array between all <span> </span> tag from HTML, I have tried with this code but it returns only one occurrence : preg_match('/<span>(.+?)<\/span>/is...
Counseloratlaw asked 15/4, 2013 at 12:53

2

In PHP I have string with nested brackets: bar[foo[test[abc][def]]bar]foo I need a regex that matches the inner bracket-pairs first, so the order in which preg_match_all finds the matching brack...
Ecphonesis asked 14/2, 2013 at 15:45

2

Solved

In PHP I have the following string : $str = "AAA, BBB, (CCC,DDD), 'EEE', 'FFF,GGG', ('HHH','III'), (('JJJ','KKK'), LLL, (MMM,NNN)) , OOO"; I need to split this string into the following parts: ...
Incursion asked 5/3, 2013 at 20:56

3

Solved

I'm trying to get emails out of a string: $string = "bla bla [email protected] MIME-Version: [email protected] bla bla bla"; $matches = array(); $pattern = '\b[A-Z0-9._%+-]+@[A-Z0...
Bathesda asked 24/2, 2013 at 10:40

© 2022 - 2024 — McMap. All rights reserved.