306 Topics

Member Avatar for
Member Avatar for klemme

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 …

Member Avatar for pritaeas
0
2K
Member Avatar for IanArcher

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 …

Member Avatar for pritaeas
0
171
Member Avatar for RicardoE

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 …

Member Avatar for smantscheff
0
143
Member Avatar for utroda

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 . …

Member Avatar for utroda
0
345
Member Avatar for utroda

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?

Member Avatar for pritaeas
0
208
Member Avatar for andimiami

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" …

Member Avatar for andimiami
0
115
Member Avatar for Dani

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 …

Member Avatar for diafol
0
2K
Member Avatar for deepak.marur

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('[', …

Member Avatar for deepak.marur
0
395
Member Avatar for woopi

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!

Member Avatar for woopi
0
1K
Member Avatar for bipies

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 :(

Member Avatar for diafol
0
104
Member Avatar for Buppy

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 …

Member Avatar for pritaeas
0
143
Member Avatar for Narayanan87

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!!!

Member Avatar for thekashyap
0
155
Member Avatar for DILO3D

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?

Member Avatar for pritaeas
0
124
Member Avatar for ghost_from_sa

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 …

Member Avatar for vibhaJ
0
247
Member Avatar for JoshuaBurleson

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?

Member Avatar for JoshuaBurleson
0
301
Member Avatar for 100110010110100

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 …

Member Avatar for 100110010110100
0
906
Member Avatar for reygcalantaol

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 …

Member Avatar for reygcalantaol
0
120
Member Avatar for JeffOwens

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 = …

Member Avatar for Enalicho
0
134
Member Avatar for Ender330

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...

Member Avatar for pritaeas
0
66
Member Avatar for arindam31

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 …

Member Avatar for arindam31
-1
235
Member Avatar for theharshest

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.

Member Avatar for Gribouillis
0
445
Member Avatar for knan

<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" …

Member Avatar for snippsat
0
221
Member Avatar for Hummdis

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 …

Member Avatar for Hummdis
0
238
Member Avatar for cjohnweb

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 …

Member Avatar for cjohnweb
0
168
Member Avatar for jogesh_p

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 …

Member Avatar for jogesh_p
0
673
Member Avatar for DILO3D

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 …

Member Avatar for ko ko
0
88
Member Avatar for pythonnoobie

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, …

Member Avatar for pythonnoobie
0
236
Member Avatar for Danny159

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 != …

Member Avatar for pritaeas
0
205
Member Avatar for cjohnweb

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 …

Member Avatar for cjohnweb
0
116
Member Avatar for Stefano Mtangoo

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 …

Member Avatar for Stefano Mtangoo
0
158

The End.