269 Topics
|
|
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 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, … |
|
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 … |
|
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 … |
|
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 … |
|
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. |
|
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 |
|
|
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: … |
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 … |
|
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 = … |
|
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; } … |
|
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 |
|
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 … |
|
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 … |
|
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, … |
|
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/ … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
Hey guys, I need to be able to get a certain value out of the following. [code] Job# : 442254 Contact : TO BE ADVISED Model : BZ500 50GN02630 Purchase Order/Your Reference : Contract Type: C3 CopyPlan - Contract Minimum Job Type: H Audit, Admin, Housekeeping Fault/Problem(s) reported: CHECK SENTINEL … |
|
Hello, I am currently passing some HTML through to preg_match and I want to access all the HTML between two tags, however as the same tags may be repeated afterwards my current expression isn't working. For example, my expression at the moment is [code]<li>(.*)</li>[/code] But as the HTML is like … |
The End.