Archive

Posts Tagged ‘preg’

Preg Split Help Needed

December 28th, 2011 Comments off

Hi there

Have a project that utilizes the pregsplit() php function. Got it kinda working but need someone to fix it for someone that is familiar with reg expressions this will take about 10 mins. Need sorted asap.

Thanks
Joe

No Ending Delimiter Found

August 18th, 2011 Comments off

I got a white page while checkout . http://www.e-liquid.cn/index.php?mai…eckout_process , not by using paypal just with others like Western Union or Online Bank payment. I know somewhere need to add “/” or other things.

PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: No ending delimiter ‘/’ found in /data/home/bmu033107/htdocs/includes/classes/template_func.php on line 30

Php – Regex Expert

March 3rd, 2010 Comments off

Create preg_match Regular Expression code to extract information from tables on 16 websites. Most of the websites will only be one page deep with one table. A handful of the websites will require a second preg_match code for a secondary page that contains the rest of the information that is needed.

I can show you the script the code will be used in. Send me a private message if you require the code before you place your bid. All I need is the preg_match code. The code needs to work 100% of the time, tested against the live page and back data. No other programming is necessary for this project.

Please tell me why you are the best, and how why you are better at making RegEx than all the rest.

Categories: PHP Tags: , , , , , ,

Preg_match_all Help

December 1st, 2009 Comments off

I want to match an image name with the page source
__________________________________________

$name = “fox hat jumps jpg”; //eg fox hat jumps jpg
$name_end = trim(substr(strrchr($name,” “),1)); //returns jpg
$end= trim(str_replace($name_end, ”,$name)); //remove the first space occurence and trim
$end = substr(strrchr($end,” “),1);//find the last word eg jumps
$end = $end.”.”.$name_end; //returns jumps.jpg

//Now get the page and find the image that ends in “jumps.jpg”

$str = file_get_contents(“http://site.com/”);
preg_match_all(‘/<img src=['"](.*?.(‘ . preg_quote($end, ‘~’) . ‘))['"]/’, $str, $a);

foreach ($a[1] as $c) {
echo $c;

break;
}

_________________________________________________

The problem is the preg match doesnt find the image ending in “jumps.jpg”

Categories: Programming Tags: , , , , , ,

Preg_replace Pattern

September 2nd, 2009 Comments off

I need the pattern for a preg_replace function. I want to remove special tags and the text between them from an article. Eg:

“asdf asdfas asdfas asdf <!–tag1–>some text<!–tag2–> asdfas sadf asdfasdfsasdf asasdfasdfasdf asdf asfd asdfasd asdfas dfasdf asdf as
asdfas asdfasdf asdf<!–tag1–>more text<!–tag2–>asdfas asdf”

I want to remove all occurrences of <!–tag1–>text<!–tag2–> including the tags themselves.

So I need the pattern for the function below:

$article = preg_replace($pattern, “”, $article)

Problem With Rss Feeds (php)

August 10th, 2009 Comments off

This job should be really easy for someone who knows what they are doing.

There is a file single php file on my article directory which controls all the RSS feeds. The problem is that the feed is incomplete and does not contain all the data I want it to. Also, certain charators like ‘ and – display as ’s and –

I need someone to fix this problem get add the required additional feed items to display and deliver a W3C Vaild RSS feed. (validator.w3.org/feed/)

The feeds render a default meta and feed title and decsription in every instance, I want them to display title that is relevant to the feed being displayed. IE, the Heath and Fitness feed displays Health and fitness feed.

The additional fields that need to display are

<author> </author>
<category> </category>

I have added these 2 and they do display when one views the source code of the feed, but not on the feed itself, not are they passed to any feed reader.

Here is an extract from the code if it helps.

$strxml = $strxml.”<title>”.getsettings(2,”",2).” Articles</title>”;

$strxml = $strxml.”<link>”.getsettings(3,”",2).”/articlerss.php?type=”.$_GET["type"].”&category=”.$_GET["category"].”</link>”;

$strxml = $strxml.”<description>Latest Articles </description>”;

$strxml = $strxml.”<language>en-us</language>”;

$strxml = $strxml.”<copyright>Copyright (c) “.getsettings(2,”",2).” All rights reserved.</copyright>”;

echo $strxml; flush();
$j=0;
while($rs=mysql_fetch_array($cmd))
{
// $url=getsettings(3,”",2).”/article” . $rs["article_id"] . “-” . urlencode($rs["article_title"]) . “.html”;
$url=getsettings(3,”",2).”/article” . $rs["article_id"] . “-” . urlencode(preg_replace(‘/[^a-zA-Z0-9s!?"']+/’,'_’,$rs['article_title'])) . “.html”;
$out=”<item>n”;
$out .= “<title>”.removechar(htmlentities(strip_tags($rs["article_title"]))).”</title>n”;

//$out .= “<link>”.preg_replace(‘/[^a-zA-Z0-9s!?"']+/’,'_’).str_replace(“ ”, “”, strip_tags($url)).”</link>n”;
//$out .= “<link>”.preg_replace( ,’3F’,preg_replace(‘/[^a-zA-Z0-9s.-:/+!?"']+/’,'_’, $url)).”</link>n”;
$out .= “<link>”.$url.”</link>n”;
$out .= “<author>”.removechar(htmlentities(strip_tags($rs["article_author"]))) . “</author>n”;
$out .= “<category>”.removechar(htmlentities(strip_tags($rs["category_name"]))) . “</category>n”;
$out .= “<description>”.removechar(htmlentities(strip_tags($rs["article_snippet"]))) . “</description>n”;
$out .= “<pubDate>” . date(‘r’,strtotime($rs["article_date"])) . “</pubDate>”;
$out .= “</item>n”;
echo $out; flush();

$j=$j+1;
if($j >= 50) break;//limit !
}

$strxml = “</channel>n”;

$strxml = $strxml.”</rss>n”;

echo $strxml; flush();

Phone Format Preg_match Syntax

August 7th, 2009 Comments off

I have a preg_match question for my own site
==================================================================================
}

class Validate_Phone_Number {
var $error;
var $PMDR;

function __construct() {
$this->PMDR = Registry::getInstance();
}

function validate($value) {
if(preg_match(‘/^((+{0,1}d{1,3}(-| )?(?d)?(-| )?d{1,5})|((?d{2,6})?))(-| )?(d{3,4})(-| )?(d{4})(( x| ext)d{1,5}){0,1}$/’,$value) OR $value == ”) {
return true;
} else {
$this->error = ‘The phone number in the following field is incorrectly formatted: %s’;
return false;
}
}
}
==================================================================================

I want to have the verify/phone format to be only accepted if it meets one format style only!
the phone format I need must be = xxx xxx-xxxx / ext. xxxx (ext. not required, it is a option)
so it must be one of the two samples to approve the phone format or else fails

a). 800 555-1212
b). 800 555-1212 / ext.1234

AdSpace

Php Preg_match_all

August 5th, 2009 Comments off

I need a php function that does a preg_match_all against http://listings.ebay.com and produces an array that has:

parent category name
sub category name
category code

For example:

20081:”Antiques”:;
37903:”>Antiques”:”Antiquities”;
4707:”Antiques”:”Architectural & Garden”;
20082:”Antiques”:”Asian Antiques”;

My goal is to be able to have a list of categories and category codes for ebay, and be able to update that list on a regular basis.

The completed code should be able to write a .txt file, that has the array as described above.

Additionally, a php program should be able to open the file, and build a select list from the stored text that will look as follows:

<option class=’catlist’ value=’20081′>Antiques</option>
<option class=’catlist’ value=’37903′>Antiques: Antiquities</option>
<option class=’catlist’ value=’4707′>Antiques: Architectural & Garden</option>
<option class=’catlist’ value=’20082′>Antiques: Asian Antiques</option>
<option class=’catlist’ value=’2195′>Antiques: Books & Manuscripts</option>

Php Preg_match Regex Job

July 21st, 2009 Comments off

I need a function to check a message on links to block links to other websites.

I have already made a function that do this. But when a user post an image / a link to an image / a link to my own website this message is blocked too.

I need a professional solution for this, that’s fast and will not bring my server down.

This will be a job to test your experience too. I will ask you for more jobs, when this is done with the best quality.

Php Preg_match_all Regex

June 24th, 2009 Comments off

Provide a PHP regular expression for the pre_match_all function that parses for specific information and returns the result in an array.

Please see attachment showing example text and the information to be parsed. One example has the information to be parsed as VAR1, VAR2, VAR3 … VAR15, VAR16. The second example has “live” data.

Script should work on a linux server using PHP version 4.3.

Payment made (via escrow if you prefer) on successful test of your regex expression on your server using another web page similar to the test page to parse.

Indicate previous experience in your reply or via PM that indicates your ability to complete this job along with bid and expected completion date.

Thank you.

Php Preg Match All Problem

March 19th, 2009 No comments

This is a quick review and quick project for someone who is very familiar with PHP.

Im using the fopen function to read the HTML of a certain website. In the Webpage HTML, there is this code:

messages, 4.95)

I need to use preg_match_all to retrieve the 4.95 part and store it in a variable.

If you do not know what I am talking about, please do not bid.

Thanks!

Bear