306 Topics
| |
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 … | |
Hi, i am new to PHP but i have some common knowledge to recognizing commands and such. in my page i have code like this [CODE]<div class="page_column page_column_first" id="page_column_1" style="width: 499px;"><div class="page_block_container" id="page_block_759"><div class="disignBoxFirst"> <div class="boxFirstHeader"><div class="dbTitle">Up and Coming</div></div> <div class="boxContent"><div class="dbContentHtml"><p>This is a placeholder for up and coming news … | |
Hello dear community, I have a problem which I have no idea how to walk around, see I have a really large database, with france zip codes, I imported this data from excel. the thing is that when it imported all the zip codes starting by 0 are not starting … | |
Hello, I'm trying to replace {include %filename.php%} with that file from the server. I can get this to work file if the file is plan html text using the function below. [CODE] $str = "This would be a paragraph of text. {include %news.php%}"; preg_replace_callback("/\{include %(.*?)\%}/", function($m) { return file_get_contents(CORE . … | |
Hello, I'm looking for some help on the following line of code, it keeps throwing an error. [I]Parse error: syntax error, unexpected T_FUNCTION Line 168.[/I] The code below is line 168. [CODE]$content = preg_replace_callback("/\{include '(.*?)'}/", function($m) { return file_get_contents(CORE . 'includes/' .$m[1]);}, $str);[/CODE] Any ideas? | |
I am writing a Java program, and I need to be able to call these two methods, but I'm kind of confused. These methods need to be able to match the following data: This would be a sample input if what I am checking... LASTNAME "Rosemont" # LASTNAME "Rose Mont" … | |
Hi, How can I use preg_replace to determine if a string contains a word beginning with a pattern, and if it does, remove it? Basically I want to capture query strings from a search, but throw away search modifiers. For example, the search query string: site:daniweb.com query would just become … | |
I have a data store having a Note field (a textarea) and want to display all Notes satisfying a user input (even metacharacters). I've written the following function to handle this: function notefilter() { var newfilter = Ext.getCmp('searchnote'); var searchStr = newfilter.getValue(); searchStr = searchStr.replace('?', '\\?').replace('*', '\\*').replace('+', '\\+').replace('{', '\\{').replace('}', '\\}').replace('[', … | |
How do I deal with quotes here? What i want is /[^a-zA-Z0-9-_.,!()'\/"]/ but how do i deal the quotes? [CODE] $pattern = '/[^a-zA-Z0-9-_.,!()'"\/' . $whatever . ']/'; return preg_replace($pattern, '', $value); [/CODE] Cheers! | |
Hi! I'm simply need to convert a string like: /blablabla/123123 to 123123 it should be easy I'm sure, but I can't get it :( | |
Hi, A quick question - i have a string containing text like this: [CODE] \\u003cspan class=\\\"someClass\\\">Some text\\u003c\\\/span> [/CODE] How do i get that "Some text" value into an array? I tried [CODE] preg_match_all("/\\\\u003cspan class=\\\\\\\"someClass\\\\\\\">(.*?)\\\\u003c\\\\\\/span>/",$str,$res); [/CODE] Returns nothing. I think there's something wrong with the regex pattern. Maybe anyone can correct … | |
HI I am new to regex, could anyone help me in finding the java code using regex: My input string is : MyData 68309486 Bob I want to fetch only the digits in sequence like 68309486. PLz help me!!! | |
i have a following paragraph. [CODE] ++ a xxx xxxx ++ b yyy yyyy yyyyy ++ c zz zzz [/CODE] i need to delete this line. ++ b yyy yyyy yyyyy What is the regular expression i want to use? | |
Hi guys, I seem to have come across a weird issue in internet explorer. I've been working on doing regular expressions for a register form, and I've checked it in Firefox, and Chrome and it seems to work for both of them but yet it doesn't work for Internext Explorer … | |
I'm having a terrible time with regular expressions, possibly because I'm using a python2 reference, but maybe not. For example how would I find \s\w within a string and then change that character? | |
I have tried parsing a website with curl and then searching it with regular expressions, but I have not been able to perform a regex search. Even if I try parsing news.google.com and then search for any non digit, the code returns that there is no match. If I run … | |
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 … | |
Here is my code: [CODE] #------------------------------------------------------------------------------- # Name: Mocha Rotoscoping Via Blender # Purpose: Make rotoscoping more efficient # # Author: Jeff Owens # # Created: 11/07/2011 # Copyright: (c) jeff.owens 2011 # Licence: Grasshorse #------------------------------------------------------------------------------- #!/usr/bin/env python import sys import os import parser sys.path.append('Z:\_protomotion\Prog\HelperScripts') import GetDir sys.path.append('Z:/Blender_Roto') filename = … | |
Hello, I need to find a way to use regex to exclude a phone number like this: +558499608822 I want any number that starts with the country code 55 to be excluded. For some reason \+55 does not work. Thanks for the help... | |
Regular Expression (RE) They can be used with string operations. Using this, we specify the rules for the set of possible strings that we want to match (Searching for patterns in another string). Note : its finds FIRST instance of that pattern We can also use REs to modify a … | |
I am using the following code to extract second name from the html having following kind of lines - <tr align="right"><td>3</td><td>Matthew</td><td>Brittany</td> So, I want to extract "Brittany" from the above line [CODE]for line in f: match3 = re.search(r'$([a-zA-Z]+)(</td>)',line) if match3: print match3.group(1)[/CODE] But this ain't working. Please help. | |
<text> <p><s id="s1"><ng><w pws="yes" id="w1" p="CD">25</w> <w l="woman" pws="yes" id="w4" p="NNP" common="true" headn="yes">Woman</w></ng> <vg tense="past" voice="act" asp="simple" modal="no"><w l="create" pws="yes" id="w10" p="VBD" headv="yes">created</w></vg> <pg><w pws="yes" id="w18" p="IN">for</w></pg> <ng><w vstem="succeed" l="success" pws="yes" id="w22" p="NN" headn="yes">success</w> <w l="barbie" pws="yes" id="w30" p="NN" headn="yes">barbie</w></ng> <ng><enamex type="location"><w l="reynold" pws="yes" id="w37" p="NNP" locname="single">Reynolds</w></enamex> <w l="sep" pws="yes" … | |
I've tried this a number of different ways and I've even downloaded the Regular Expression reference sheet from addedbytes.com, but I just can't figure out how to move this eregi_replace() statement into a preg_replace() statement. I've read and understood the delimiter requirements for preg_replace(), but I think the problem is … | |
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 … | |
hello friends i am new in php, i tried a code to remove special characters into the string, i tried the following codes,, [code=php] $user = "some string here"; preg_match_all('/[^A-Z][^a-z_-][^0-9]/', $user, $result) [/code] but the problem is that if i give the string like : name@#$@$# it also accepted buy … | |
i have a following text in a file: host1 menu=gateway title=gateway host=192.168.0.1 host2 menu=xgateway title=xgateway host=192.168.0.2 host3 menu=ygateway title=ygateway host=192.168.0.3 I have to match the 3 lines folowing by "host2" . these lines need to be matched. host2 menu=xgateway title=xgateway host=192.168.0.2 I used this codes.But its not complete. Can anyone … | |
I need to find a pattern of kind APP[a-z][a-z][0-9][0-9][0-9] in the body of HTML and then replace them with hyperlinks. I am using Beautiful Soup to replace as I am dealing with HTML content. For Eg: APPsd222 to [URL="http://www.dani.com/APPsd222"]APPsd222[/URL] APPfd333 to [URL="http://www.dani.com/APPfd333"]APPsd333[/URL] If you are not aware about Beautiful Soup, … | |
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 != … | |
Hello! I've come across a little problem with Regex, I was hoping someone might see the problem off hand. Here is some sample content I am searching through, It's the gameshark codes for PEC: [code] #Ace Combat 3 Electrosphere#SLPS-02021#SLPS-02020 §N Joker Command D00BF32E ???? "Infinite Time for battle D0054332 2442 … | |
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 … |
The End.