I'm trying to extract the users who ask questions on a classified ad website(http://trademe.co.nz/Trade-Me-Motors/Cars/Toyota/Hiace/auction-300294634.htm) . For some reasons the pattern which I'm using is not working always so I would appreciate if you will help me with a perfect regex
Here is my current code
/get memberid of the que...
Can't seem to figure this one out. Just trying to preg match for a specific variable name in a link URL:
<a href="http://something.com?variable=name">GenericLink</a>
How do I get the variable=name out of this?
Thanks!
...
I'm having a problem with my preg_match_all statement. It's been working perfectly as I've been typing out an article but all of a sudden after it passed a certain length is stopped working all together. Is this a known issue with the function that it just doesn't do anything after so many characters?
$number = preg_match_all("/(<!-- ([...
So, I'm basically trying to match anything inside (and including) object tags, with this:
<?php preg_match_all('/<object(.*)<\/object>/', $blah, $blahBlah); ?>
It finds a match for this:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/fl...
Hey guys,
I don't consider myself a PHP "noob", but regular expressions are still new to me.
I'm doing a CURL where I receive a list of comments. Every comment has this HTML structure:
<div class="comment-text">the comment</div>
What I want is simple: I want to get, from a preg_match_all, the comments that have the word "cool" in th...
I have a text document that lists urls with their subject and an email address. I need to extract all urls with their subject and the email address and put this all into a csv file. I just need to know how I can use regex to do this. Currently I am able to extract all urls but I need the email and subject associated with them. This is wh...
I have an array of regular expressions and am trying to loop through a text document to find the first pattern, assign that as the key to an array then continue through find the second pattern and assign that as the value. Whenever I come across pattern 1 I want that to always be assigned as a key and all pattern 2 matches that follow un...
hi to all
i am using php and i am having problem to parse the href from anchor tag with text.
example: anchor tag having test http://www.test.com
like this <a href="http://www.test.com" title="test">http://www.test.com</a>
i want to match all text in anchor tag
thanks in advance.
...
Hey!
I am quite new to the whole Regex thing and tried to do a preg_match_all in PHP which, kind of the results I wanted but the problem is it matches everything after what I actually wanted... like so:
String: This is something <code>Some code here</code> and more
Match from Regex: <code>Some code here</code> and more
Wanted match fro...
code-
$res=$this->post("http://address.mail.yahoo.com/?_src=&VPC=print",$post_elements);
$emailA=array();
$bulk=array();
$res=str_replace(array(' ',' ',PHP_EOL,"\n","\r\n"),array('','','','',''),$res);
preg_match_all("#\<tr class\=\"phead\"\>\<td colspan\=\"2\"\>(.+)\<\/tr\>(.+)\<div class\=\"first\"\>\<\/div\>\<...
on a given page there are bunch of elements:
<div class="some class"> <-- here is anything, other divs, even other divs with
the same class, but I need to match right on closing tag for this particular
opening tag --></div>
...
Hi since hours im trying to get a regex which is able to find the following part in a string.
[TABLE|head,border|{
#TEXT|TEXT|TEXT#
TEXT|TEXT|TEXT
TEXT|TEXT|TEXT
TEXT|TEXT|TEXT
}]
Its from a simple self made WYSIWYG Editor, which gives the possibility to add tables. But the "syntax" for a table should be as simple as the one above.
N...
This may be a lame question but I am a total novice with regular expressions. I have some text data in the format:
Company Name: Name of the company, place. Company Address: Some,
address, here. Link:
http://www.somelink.com
Now, I want to use a regex to split these into an array of name : value pairs. The regular expression...
Hi,
I'm a PHP newbie. I'm trying to use preg_match_all function in the below program to find all subjects with their marks, but I'm getting only one match. I have been struggling with this for 5 hours. Can someone help me in figuring out whats wrong? Thanks in advance.
<?php
$semArray="<B>STUDENTS NAME (7ab05cs001) </B><br><br><br><br>...
I have a text:
$test = <<<START
DOTHIS themsp1
@theint = 431,
@theText = "%dumdum%",
@operator = 'ANY',
@crossCheck = 'PLUS'
START;
The filter:
$regEx = '/@(.*)=(.*)[,]*?/';
preg_match_all($regEx,$test,$vars,PREG_SET_ORDER);
print_r($vars);
The Output:
Array
(
[0] => Array
(
[0] => @theint ...
I am trying to right a preg_match_all to match horse race distance.
My source lists races as:
xmxfxy
I want to match the m value, the f value, the y value. However different races will maybe only have m, or f, or y, or two of them or even all three.
// e.g. $raw = 5f213y;
preg_match_all('/(\d{1,})m|(\d{1,})f|(\d{1,})y/', $raw, $distan...
Hello all,
I have a string with some codes (ex:«USER_ID#USERNAME#STATUS») for replacement like in this example:
Hello «USER_ID#USERNAME#STATUS», do you like «PROD_ID#PRODNAME#STATUS»?
I need to find a way to get all the codes for future replacement.
I can easily find one code with this regex:
/«(.*)#(.*)#(.*)»/
but can't f...
This is the regex i'm trying to use:
/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/gim
I found it on this site, and it works great when i try it out there. But as soon as i place it in my code i get this message:
Warning: preg_match() [function.preg-match]: Unknown modifier 'g' in C:\xampp\htdocs\swebook\includes\classes.php on line ...
My source string is this:
{categories group_id="3"}
{category_name}
{/categories}
{categories group_id="4"}
{category_name}
{/categories}
My regex is this:
preg_match('/{categories group_id="3"}(.*){\/categories}/s', $tagdata, $matches);
Which results in:
Array
(
[0] => Array
(
[0] => {categories group_id=...
I'm using PHP and I have text like:
first [abc] middle [xyz] last
I need to get what's inside and outside of the brackets. Searching in StackOverflow I found a pattern to get what's inside:
preg_match_all('/\[.*?\]/', $m, $s)
Now I'd like to know the pattern to get what's outside.
Regards!
...