27 Topics
|
|
Hello everyone i have a pattern that checks the given url is correct or not and this is working perfectly fine, but when i give arabic chrarcters in pattern it return false because of invalid URL. I want english and arabic chracter to check in URL. where i can do … |
|
Hello Everyone, As the title implies I need help extracting a name out of a string, my knolwedge of regular expressions is pretty limited. The strings I will be working with will look like this: 12345 Aragon Denvil L. 123-1234 A123456 AragonD AragonAD@fake.mail.us 1000001234 ABC-ABC 123ABCD123 ABCD 1234 A1234 ABC12345A1 … |
|
i have a function which is supposed to check if a number is a floating-point number. this is the structure of the function function isValidFloat( $string ){ if( !preg_match( "/^[0-9]+(.[0-9]+)?$/", $string ) ){ return false; } } for numbers such as 1 or 8 it's correctly validating but not for … |
|
Hi, is there any preg_match only allow `a-zA-Z0-9():[space]` ? Please help me =( |
|
Hello I'm want to convert string to array $str = "[cat=[0=php,script=[js]],id=4,foo=bar]"; how to write `preg pattern` for change `$str` to : $str = "[cat=[0=php,script=[js]]_-_id=4_-_foo=bar]"; If convert `,` to `_-_` I can convert this string to array by `foreach`, but i can't convert `,` to `_-_` in this string I'm want … |
|
In brief, I am puzzled as to why `~^[0-9]*?\|[0-9]*?\|.*?\|.*?\..*?\|2\|[0-9]\|.*?$~m` matches `1362526368|5|Corinne E. Fischer|fischer.jpg|3|3|FischerC@smh.ca|416-864-5320|1|2|3|4|5` Note the |3| after fischer.jpg when the pattern clearly has a \|2\| in that location. Now I understand that it must be the numbers at the end that are messing with the match but I don't really … |
|
I am making a basic craigslist type website with a search function. There is a field where you can enter what you think the name of the product might be and my search function is supposed to find names of products that match. so for example a user can enter: … |
|
I have the following code. I wanted to determine if the value inputted in $cellno (from a textbox) are all digits (numbers), and if it's 11 numbers, and if its starting numbers are "09". One correct value example is 09345678910. It is all numbers, has 11 digits, and begins in … |
|
|
I wanted to validate a string with preg_match but after a lot of struggle I just used if($str[0]!='x'.... but just out of curiosity I wonna know how to do this using preg_match I'm getting a string as an input- the 1st char in the string must be % the 2nd … |
I have a problem in a payment solution I have made. In this, I use ereg to extract a returned Transaction ID from the payment provider, and with PHP 5.3 this does not work anymore. The code used was: ereg('<TransactionId>(.+)</TransactionId>',$resultat_3,$c); I have tried to use this instead: (but it doesn't … |
|
Hi all i want to check regular expression of a text field value i.e. it should not contain any '.,@' and other special characters except '_' and '-'. How can i write my rule in [code]preg_match()[/code] ? |
|
Hi all, I am dealing a small issue. I am missing something silly :). My need is that I want the entire lines between <TABLE> </TABLE> with no modifications. [CODE]<?php $some_string = <<<STR <HR noShade size=2> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="" > <TR BGCOLOR="c1ffcc"> <TH ALIGN="LEFT" COLSPAN=22> <font face="Arial,Helvetica,Geneva,Swiss,Verdana" size="2" … |
|
I would love to know, if it's possible to get a specific data from a specific mysql table.. Let say on the table itself has a Varchar ... mixed of words and floats.. and then ... I want to pull only the float from the table using php... can it … |
|
Hi guys, I would like to validate some form input, and only allow the folowing: letters, numbers, /, - if(!preg_match("*[0-9A-Za-z,-,/]", $url_key)){ $erros[1] = '<small>Error submitting url key!</small>'; } Which is not working.. Its not the point only to allow one / or - But only letters, numbers and /- in … |
|
Hello guyz, I'm glad I finally back here. I need help using the preg_match function. I am scraping url and I need to get the specific value from the html tags. Here is the string [I]<p><b>1,664</b> Referring IP addresses</p>[/I], I need to get [I][B]1,664[/B][/I] How can I achieve it using … |
|
So, I have this wordpress driven site, and I have a plugin written that runs when a post is viewed. The content of the post is loaded into $content. I also have a database of keywords and links to other posts on my site. I want to search the $content … |
|
Hey, I have the following script... [CODE]if(!opendir($image_dir)){ echo info_msg("Ooops... This Album contains no images"); }else{ /* step one: read directory, make array of files */ if ($handle = opendir($image_dir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..' && preg_match("/t/",$file) && $file != … |
|
Friends, I'm rushing towards deadline and I think that makes me do childish mistakes. Here I have validation that requires regex and each time I input valid expression preg_match returns false. It is long now I'm trying to spot error but I cannot! I have googled and AFAICS, things seems … |
|
Hi guys, It is working fine, and only allowing letters and numbers. I want to a feature, so that it has to be between 3-20 charachters/numbers long. [CODE] if (!preg_match("/^[A-Za-z0-9]+$/i", $_POST['brugernavn'])){ $dosomething = ''; } [/CODE] This is not working: [CODE] if (!preg_match("/^[A-Za-z0-9]{3-20}+$/i", $_POST['brugernavn'])) [/CODE] |
|
Hi, Can someone lead me in the right direction on how to write a preg_match. I have username and password in the DB. And the username should be case sensitive, accordingly to whatever is in the db. And it should only be able to contain numbers and letters. I have … |
|
Hello all, I am trying to use more regex but I can't seem to get this to work. The aim is to check inputs for either [url, [link or <a href: [CODE] $islink = false; foreach($_POST as $k => $v){ if((preg_match("/[url|[link|<a href/i", $v)) > 0 ){ $islink = true; } … |
|
How can I get some part of $B to be only [B]auto[/B](The first word in $A[1])? [CODE] if(preg_match('/^(.*)">(.*)/',$A[1],$B) == 1) { die($B[1]); } [/CODE] $A[1] is.... [B]auto[/B]">auto</a>, <a href="automobile">automobile</a>, <a href="motorcar">motorcar</a>, <a href="machine">machine</a></div><div class=Rel><a hr .................................... /tr><tr><td><a href="zw |
|
For example here is some code..... [CODE] preg_match_all("/<a(?:[^>]*)href=\"([^\"]*)\"(?:[^>]*)>(?:[^<]*)<\/a>/is", $stripped_file, $matches);[/CODE] What I don't get is all of those special characters? (?:[^>]*) How can I do this with the h1 tag, h2 tag, and h3 tag? |
|
i have a field in my database with numbers like this....... ,27,,277,,4277,,677,,678,,6688,,8754,,123478, each number was updated (added) like this .. ,27, all numbers updated are unique, when i try to match ,27, i get ,27, ,277, ,4277, not just ,27, my code is like this... [code=php] $id = 27 $string … |
|
Hello, I'm totally out of luck with creating a working patternt to match for my preg_match. What I would like to do is, create a pattern that will match sentenses in a bunch of text.. It should recognize a word that has a capital letter and take it as the … |
|
Anyone have an idea what the regex would be for preg_split to split a string at a semicolon ([icode];[/icode]), but ignore any quoted (single or double) parts as well as ignore escaped ([icode]\;[/icode]) semicolons? I have tried to decipher this one and could not (regex not my strongpoint - YET) … |
|
Hello people, I'm trying to collect some data stored between <body> and </body> tags inside a string. Here's a piece of the code i'm using: [CODE] $regex = '/<body>(.*?)<\/body>/si'; preg_match($regex, $content, $content); $content = $content[0];[/CODE] This works perfect, except that it also includes the above mentioned tags. I would just … |
The End.