306 Topics

Member Avatar for
Member Avatar for klemme

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]

Member Avatar for klemme
0
4K
Member Avatar for QuesoTaco

I am studying viruses and trying to figure out how the FLEX module works for C++. I have taken classes before on regular languages, context free, etc. Is FLEX dealing with regular languages or regular expressions, and also what is the difference exactly? Could you give an example of how …

Member Avatar for gusano79
0
231
Member Avatar for NuGG

I have the following code witch is used to display HTML from an XML file. The XML file itself comes from a form POST where a "\" is added in after various HTML tags. Is there anyway I can modify the script below to hide/remove the "\" when the XML …

Member Avatar for ko ko
0
1K
Member Avatar for klemme

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 …

Member Avatar for blocblue
0
155
Member Avatar for QuesoTaco

I am trying to get consecutive words in a document using flex. Normally the forward slash should work, but for some reason it is not. Also I need to account for spaces. So I can't seem to use that regex character for this, how do I account for consecutive words …

0
132
Member Avatar for scarlettmoon

Working with javascript / jquery - Need to have a more precise regex for the following pattern: Should I have the ignore case included? If so where? X25b777s44K The regex I have: ^([A-Z]?)(\d{2})([a-z]?)(\d{3})([a-z]?)(\d{2})([A-Z]?)$ Thank you for your help.

Member Avatar for scarlettmoon
0
160
Member Avatar for ssreevidya.m

hai, I want an expression for all alphabets and some special characters like . - ' etc. I use an expression like ^[-_'.,A-Za-z]* but it doesnt contain '. can i get a correct expression for this. Thanks in advance Sreevidya

Member Avatar for shakeb@techwave
0
135
Member Avatar for diafol

Hi all, preg-Replace has stumped me again. I'm just too thick to get it. This is my problem: I have two files. File 'newvalues.php' with an array like so: [CODE].... $lang['this_key'] => 'blah blah blah'; $lang['another_key'] => 'rhubarb rhubarb'; $lang['something_else_key'] => 'twitter twitter'; ....[/CODE] And another file: 'template.php' like so: …

Member Avatar for diafol
0
158
Member Avatar for swinchen

I am working on a project that requires me to clean data from a series of RS-232 instruments. These instruments can have a different version number, and output format (both of which can change the expected ouput). On top of that there are flags that determine if certain fields are …

0
137
Member Avatar for umesh314

Hi all , i have a string var containing info like this. [B]STRING[/B] = "Are you posting in the most appropriate place [B][COLOR="Red"]PKG0620_REL_23_Nov_2010[/COLOR][/B] to receive relevant replies" So, my program will ask only "PKG0620" info to be given by the user which i am storing in SEARCH var. SEARCH = …

Member Avatar for umesh314
0
126
Member Avatar for liamfriel

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; } …

Member Avatar for liamfriel
0
161
Member Avatar for russellharrower

So I got most of the code working, but what I am trying to do, is say someone post the following This is a great youtube video [url]http://www.youtube.com/watch?v=pkrM7x0_fcI&feature=channel[/url] what do you think. I want it to turn the youtube link to [url]http://www.youtube.com/v/pkrM7x0_fcI[/url] but keep the text that they typed so …

Member Avatar for vinnyBenson
0
623
Member Avatar for joomphp

hi! i have some html code like this [CODE] The Chihuahua Desert <a href="index.php">Dirt</a> Fest is <a href="/index.php">coming <a/>up, next February 17-19. <a href="http://google.com">Three</a>[/CODE] i want to replace /index.php with [url]http://google.com[/url] and index.php with [url]http://google.com/[/url] and idea how can i do this

Member Avatar for pritaeas
0
185
Member Avatar for linezero

I am trying to move a match from a match collection to another listbox as string. here is my regex code [CODE]Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/pos/leftpanel.html") Dim response As System.Net.HttpWebResponse = request.GetResponse Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream()) Dim rssourcecode As String = sr.ReadToEnd Dim r As New …

Member Avatar for codeorder
1
296
Member Avatar for RoyalElite96

Hello everyone. I am working on this forum/post/script type thing. What I want to do is convert this example to HTML. [div] [p]Some text[/] [div] Some more text [/] [/] ---> <div> <p>Some text</p> <div> Some more text </div> </div> I don't want to use [/div] or [/p] to keep …

Member Avatar for kekkaishi
0
107
Member Avatar for ofir0803

Hi i have this string: [CODE]<div class="col-price"> <h4>you save</h4> <span ><span class="currency">$</span>32</span> </div> <div class="col-price"> <h4>discount</h4> <span >52%<span class="persent"></span></span> </div> <div class="col-price last"> <h4>original price</h4> <span ><span class="currency">$</span>62</span> </div>[/CODE] i want to be able to find the values of: [I]you save[/I], [I]discount[/I] and [I]original price[/I]. the desierd output: 32, 52, …

Member Avatar for kekkaishi
0
142
Member Avatar for perlnoob

Sample content of the file [CODE] PP: Happy Sunday! PP: It's a good weather. PP: Have a blessed Sunday everyone. the output should be HL: Happy Sunday! PP: It's a good weather. PP: Have a blessed Sunday everyone [/CODE] My code to generate that [CODE] $length=@fileinput; if($line=~/PP:\s/) { {if($j<$length) {if($line[$j-1]!~/PP:\s/ …

Member Avatar for d5e5
0
118
Member Avatar for lobstar

Hi, I am using cURL to grab the contents of a webpage which contains a table. I am trying to make an array out of the table contents, with the column headings as the array keys. Unfortunately the first row of the table, before the headers, has pagination which is …

Member Avatar for lobstar
0
468
Member Avatar for Perl_enthusiast

Hello everyone who reads this. I am currently creating a program in which the user inputs a booking reference which will allow them to overview flight details that they have added to previosu flights. I have been having trouble working out which direction I should follow to sort out this …

Member Avatar for Perl_enthusiast
0
958
Member Avatar for danholding

please bare with me as im a returning newbie and have not really used re.expression much and still get very confused! my problem! i am currently working on a few database records which need appending. this is one of the files i need to resort the data base has now …

Member Avatar for TrustyTony
0
425
Member Avatar for linezero

I'm trying to use this url as regex but it doesnt seems to be working 'sorry of my bad english' Full code: [CODE]Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/pos/leftpanel.html") Dim response As System.Net.HttpWebResponse = request.GetResponse Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream()) Dim rssourcecode As String = sr.ReadToEnd Dim r As …

0
128
Member Avatar for Joe34

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

Member Avatar for smantscheff
0
163
Member Avatar for killerpopiller

Hi, I can connect to an energy-meter (Baudrate 300!) and the logfile with 228 lines comes slowly in.[code=Python]line = ser.readline(eol='!') print line [/code] If I use the above code, the complete logfiles is shown. And if I parse separatly saved logfiles with match, it sorts out the right values into …

0
126
Member Avatar for judithSampathwa

hi there, i have been asking this question every time. [CODE] public bool ValidateTelNo(string TelNo) { bool value = false; string rePhoneNumber = @"[1-9]\d{2}\s?\d{3}\d{4}$"; string PhoneNoFormat = @"\([1-9]\d{2}\)\s?\d{3}\-\d{4}$"; Regex re = new Regex(rePhoneNumber); Regex re1 = new Regex(PhoneNoFormat); if (re.IsMatch(TelNo) || (re1.IsMatch(TelNo))) value = true; else value = false; return …

Member Avatar for kvprajapati
0
108
Member Avatar for Joe34

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?

Member Avatar for blocblue
0
474
Member Avatar for mnmo88

Hi guys, this is the first time for me to post something, i'm really a big fan of the site and so far every time i get stuck in something at uni i come to here. so thanks for helping me survive so far. anywho, i'm here because i need …

Member Avatar for mnmo88
0
144
Member Avatar for jrhitokiri

I am trying to get Domain names/URLs from the title and description in ebay, but the text varies a lot. Note that the url/domain names are limited to *.com, *.net, *.info, etc. For instance, I'd have to parse through text such as: IPAD SCREEN LENS.COM 3 4 5 Letter LLLL …

Member Avatar for jrhitokiri
0
124
Member Avatar for DoctorGiraffe

Hello! Yes, This is my first post. And it might seem a little selfish that i just joined to ask a question, so don't worry, i'm not gonna ask and run, i'll stick around. So my problem, what im trying to do is using regex i'm pulling information from a …

Member Avatar for codeorder
0
977
Member Avatar for matt_platts

Im trying to use a regular expression backreference to reference a hash key. Here's an example of the non working code so you can see what I'm trying to achieve (I hope!): [CODE] $str="String of text containing item1 and item2"; $x['item1']="Item 1"; $x['item2']="Item 2"; $str=preg_replace("/item1/","$x[\${1}1]",$str); print $str; [/CODE] I want …

Member Avatar for matt_platts
0
137
Member Avatar for MisterSnrub

My form has a RegularExpressionValidator that validates user input in a textbox, lik so: [CODE] <asp:TextBox ID="taSSN" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="revSSN" runat="server" ControlToValidate="taSSN" ValidationExpression="^\d{3}-\d{2}-\d{4}$"> Invalid! Remember, you MUST type in the dashes!! </asp:RegularExpressionValidator> [/CODE] Suppose that that the regular expression I want to validate is the standard U.S. Social Security Number …

0
71

The End.