help with pregmatch Programming Web Development by realnsleo how can i verify the validity with the php pregmatch function. The string starts with a year, then a dash, followed by between 1-3 numbers, another dash,then betweek 1-5 letters, another dash, thenmore letters between 1-10, another dash and finally between 1-3 letters for example:[code]2007-03-DPE-MSK-001[/code]thanks Re: help with pregmatch Programming Web Development by digital-ether …;382926]how can i verify the validity with the php pregmatch function. The string starts with a year, then a dash… serch text file Programming Web Development by cosby … file using pregmach . i have try the patterns of the pregmatch() but it seems like i dont doit right. can someone… PHP Regular Expression special characters Programming Web Development by prem2 …. But, the main problem is do not write the own pregmatch, instead need to modify the existing one which accepts the… Re: PHP Regular Expression special characters Programming Web Development by diafol >I have tried several ways. But, the main problem is do not write the own pregmatch, instead need to modify the existing one which accepts the brackets(). Sorry this is unclear. Can you explain further? Parse error: syntax error, unexpected 'if' (T_IF) ine 5 Programming by Passy …-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/"; if(!pregmatch($pattern,$POST[`email`])) { exit("please enter a valid email… Parse error: syntax error, unexpected '}' line 13 Programming by Passy …-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/"; if(!pregmatch($pattern,$POST[`email`])) { exit("please enter a valid email… Notice: Undefined variable: db in line 78 Programming by Passy …-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$"; if(!pregmatch($pattern,$POST['email'])) { exit("please enter a valid email… Re: php regex for form validation Programming Web Development by cwarn23 … following may do the job: [CODE=php]<? //name if (pregmatch('/((*[ ]*|*\-\-*)?[ ](*[ ]*|*\-\-*)|(*[ ]*|*\-\-*)[ ](*[ ]*|*\-\-*)?)/i',$data)) { //error found as name contains double dash or… more than one space } //phone if (pregmatch('/[^0-9]/i',$data)) { //error found as it contains non… Re: PHP Form Validation with Email Push to 3rd party Programming Web Development by GreaseJunkie … field.<p>"; $error++; } }[/CODE] Then I have pregmatch and error output. All basic stuff. I have been playing… Re: help with sorting out messages Programming Web Development by diafol … the data into an array or go overboard with a pregmatch. Re: URL encoding Programming Web Development by veedeoo … this recordID to base 64, unless you want to use pregmatch on the url extracting this part, and then use base64_decode… Re: vBulletin 4.2 remote login Programming Web Development by LastMitch **@Weliaz** >It current gets the login process right, however it doesnt save the cookies right:( I'm not sure if you find an answer for your issue yet. You need to create a `pregmatch()` regex and plus does `codecall_$username.txt` exist at all? Re: Proxy Checking Problem Programming Web Development by veedeoo … data to a PHP function called stripos or even better pregmatch. if (preg_match("/html/i", $data)) { echo 'IP is… pregmatch / patterns Programming Web Development by cosby hi everyone can someone help me with the regular expression to chop the string in to peaces basically i am looking for a pattern to match this line in the file. "1980_1.rtf" (5 December 1984) Cosby and Cosby (189 street of people) i want to get a specific string on the line,i want to achive the following results. string num 1 = "… Re: pregmatch / patterns Programming Web Development by somedude3488 why not use a comma seperated data file that can easily be processed with php. does the file have to be formatted that way? pregmatch for letters, numbers, slash and - hmm? Programming Web Development by 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 the desired … Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by pritaeas [CODE] if(!preg_match("~[0-9A-Za-z-/]+~", $url_key)) {} [/CODE] The ~ marks the begin and end of the regex (any 2 matching chars). You do not need a comma to separate the items. The + says it has to be one or more of the preceding characters. Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by klemme [B]I forgot to mention that it needs to start with a slash /[/B] and only contain lower case letters and numbers too and the spacial chars as / _ - :-) [CODE] if(!preg_match([a-z][0-9][-/_], $url_key)){ $error[1] = '<small>Error submitting url key!</small>'; } [/CODE] Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by klemme So if i want it to begin with a slash, and then after that only allow lower case letters, numbers, dash and slash.. I understood preg_match returns 1 or 0, for false or true: [CODE] if(preg_match("/^[/][a-z0-9-/]+$/", $url_key)==0) { echo 'error'; } [/CODE] But that throws me this error: Warning: preg_match() [function.preg-match]: … Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by pritaeas Because you used a slash as begin/end terminator, it means you will have to escape it, if you need to use it in the pattern (with a backslash). Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by klemme Thank you for helping out pritaeas! With this one: [CODE] if(!preg_match("~[0-9a-z-/]+~", $url_key)) {..} [/CODE] I can write anything as long as there is either a number, a lowercase letter or a slash or a dash. So this goes through the validation, with the above preg_match because of the slash at the end: ***^^!"#"!ยค%&… Re: pregmatch for letters, numbers, slash and - hmm? Programming Web Development by pritaeas Use the start and end markers ^ and $ PregMatch seems to skip entries it should hit. Programming Web Development by Aeonix Not so long time ago, I asked you for help with `preg_match()`. Pritaeas gave me nice answer and Cereal showed me nice webpage where I could try out the latest queries, live. The query provided seems to be working on the website granted, but not on my project. 4 out of 6 "hits" are triggered, even though all 6 are supposed to hit. I can … Re: PregMatch seems to skip entries it should hit. Programming Web Development by diafol Can.t you post code here? Pointing to a filehost is all well and good. But zips make me nervous if I don.t know the source. Also files on filehost are ysually temporary so a missing file could kill the thread for anybody perusing the thread in the future. Re: PregMatch seems to skip entries it should hit. Programming Web Development by Aeonix Unfortunately I can't. Two reasons for that, [here's one (DaniWeb)](https://www.daniweb.com/community-center/daniweb-community-feedback/threads/500765/cannot-paste-anything), the second is that the script is dependant on 2 files (if not 3 or 4). Pasting it here would be quite a mess. The code "box". Doesn't support standard right-click … Re: PregMatch seems to skip entries it should hit. Programming Web Development by cereal By changing line 50 with: return array_map('trim', $z); you avoid new lines in the **ParseVariables()** generated array and let the regular expression match the pattern. A problem I see is an undefined index at line 60, which is: $toReplaceTemplate[$index] = str_replace($contentFrom, $replaceDict[$indexToGo], $toReplaceTemplate… Re: PregMatch seems to skip entries it should hit. Programming Web Development by Aeonix Before slamming solution into my editor, I'd like to ask you some questions (looking at your modifications). I want to learn it and understand it, instead of braindead-ily copy-paste everything. *[snap! deleted two questions, after some thinking I understood]* Line 56, you said: > By changing line 50 with: > `return array_map('trim', $z);` … Re: PregMatch seems to skip entries it should hit. Programming Web Development by cereal > Line 30, $options = array(). Why did you need to declare $options as a parameter? The constructor works like a function, so you have to declare the expected parameters, as example when you call: $sys = new Engine(array('abc')); In the class you need: class Engine { public function __construct($data) {… Can someone fix this pregmatch ? Programming Web Development by MoreBloodWine Code: [code]<?php $data = file_get_contents('http://support.xbox.com/en-gb/Pages/xbox-live/xbox-live-status.aspx'); preg_match_all('~<div id=\'xbox-live-status-box\'>\s*(<div.*?</div>\s*)?(.*?)</div>~is', $data, $matches ); print_r($matches); ?> [/code] Result: Array ( [ 0 ] => Array ( ) [ 1 ] => …