PHP - Moved: Preg Matching An Address
This topic has been moved to PHP Regex.
http://www.phpfreaks.com/forums/index.php?topic=311251.0 Similar TutorialsThis topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=311437.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=310802.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351288.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=354568.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=331482.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=321641.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=345772.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=326673.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=348670.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=351561.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=319606.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=359217.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=310162.0 I have a form with PHP validation and also a mysqli query checking for duplicates in the database for mailing address and email address in mysql.
It works fine but the customers are adding spaces in the mailing address for example 111 mailing address A V E, 1 1 1 ma iling address A V E etc. and my sql query doesn't see that as an address that's a duplicate.
Their alslo adding email address like my@emailaddress.com and m.y@emailaddress.com, m.y.2@emailaddress.com etc to bypass that comparision also.
Is there anyway to stop this from happening?
Hello, I am trying to crawl a website and get all the domain names listed on the site to output into my php script. I am using the following code.... The main area is the preg match area, since I know nothing about it, nor do I understand it a little bit! $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://link I am getting data from.com); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); // Search The Results From The Starting Site if( $result ) { // LOOKING FOR ANYTHING.COM all .com's preg_match_all( "(.*)\.com", $result, $output, PREG_SET_ORDER ); foreach( $output as $item ) { // ALL LINKS DISPLAY HERE print_r($item); } } Any help would be greatly appreciated! So i have this script that outputs Listed Files inside a folder echo '<option value="'.$fileName.'">'.$fileName.'</option>';} like this : <option value="Fonts/28 Days Later.ttf">Fonts/28 Days Later.ttf</option> etc files .... i would like to know how may i remove " Fonts/ " And the .ttf extension from the second part that repeats (the name) using something like preg_replace and to make the first letter uppercase using ucfirst() And if someone is familiar with preg_replace could you please give me a tutorial on how it works to replace some text ? Thanks In Advance so I use file_get_contents to get the contents of a webpage, one of the lines has Code: [Select] <meta property="og:url" content="http://www.google.com/blahblahblah?s=5cd04d4a7632296b9cdb463d04e82c05" /> I want it to echo only http://www.google.com/blahblahblah so anything between <meta property="og:url" content=" and ?s=5cd04d4a7632296b9cdb463d04e82c05" /> I want to extract and put into a variable this works just fine but I was thinking preg match would be better $thread = explode('<meta property="og:url" content="', $psuc); $thread = explode('?s=', $thread[1]); echo $thread[0]; Thanks basically what i am trying to do is replace the <a href="whatever.com"> with <a href="whatever.com" onclick = "if (! confirm("Continue?")) return false;"> so that when the user clicks the url in a message the box pops up first then redirects them to the url if they click confirm. However i am getting the following error: Code: [Select] Warning: preg_replace() [function.preg-replace]: Compilation failed: reference to non-existent subpattern at offset 11 here is the code i used. $message_content = $content_info['message_content']; $pattern='<a href="\\1">'; $replace='<a href="\\1" onclick = "if (! confirm("Continue?")) return false;">'; $message_content = preg_replace($pattern, $replace, $message_content); echo $message_content; Anyone know where i went wrong? Hi, Say you had, <business_name type="string">L Choong</business_name>, contained inside a variable(content before and after this in the same var), how would you extract the 'L Choong' information as a new var? Thanks im having trouble using this function. im trying to change the strings within a post. eg: Code: [Select] This is an example post [attachment=file.png] what im trying to do is change [attachment=file.png] to file.png. Here is the code i have but it doesnt change anything. $p_content = str_replace('<br>', '', $post_info[$key]['p_content']); $attach = preg_split('|\[attachment=|', $p_content); for($i=0; $i<count($attach); $i++) { $attach[$i] = str_replace(']', '', $attach[$i]); if(file_exists($config['asf_root'].'attachments/'.$attach[$i])) { $p_content = preg_replace('|\[attachment=([0-9a-zA-Z\.-_])\]|#i', $attach[$i], $p_content); } } echo $p_content; it first gets all the attachment tags within the post then applies the preg replace to all of them. But the preg replace isnt replacing, so i must have gone wrong somewhere. Any tips/ideas? Thanks |