1,034 Topics
![]() | |
Hello people, I'm trying to collect some data stored between <body> and </body> tags inside a string. Here's a piece of the code i'm using: [CODE] $regex = '/<body>(.*?)<\/body>/si'; preg_match($regex, $content, $content); $content = $content[0];[/CODE] This works perfect, except that it also includes the above mentioned tags. I would just … | |
my coding to ignorecase isn't working but the else statement does. I have system.using regular expressions allready. it runs without errors but it dosn't ignore capitals. [CODE] private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked == true) { Regex word = new Regex (wordtextBox.Text, RegexOptions.IgnoreCase);// dosn't work } else … | |
Hi Daniweb. I've been working on a project for quite a while, and posted many problems that I encountered on Daniweb. Thank you to all the users who helped me. Every single one of those problems where solved in less than 24 hours after posting on here. My project mostly … | |
Hello! I am fairly new to regular expressions (in PHP in particular, since there seem to be some special requirements/restrictions), and am especially stumped with my most recent attempt at parsing two particular strings. The first one is a URL in which I want to retrieve the first variable: [code]http://somesite.come/page.html?var=1234&some=2[/code] … | |
Hi Daniweb. I just read the other threads on regex and couldn't find the help I am looking for. The problem is simple. I have a bunch of settings in a .xml file which I read into my program. One of the settings is '*.txt', which is used for regex … | |
Hello everyone, I am trying to process various texts by regex and NLTK of python -which is at [url]http://www.nltk.org/book-[/url]. I am trying to create a random text generator and I am having a slight problem. Firstly, here is my code flow: Step-1)Enter a sentence as input -this is called trigger … | |
Hi Im trying to to simply list all security groups from active directory as i will then be doing checks on folders with the mathcing security group. I can list all the users from active directory with this: [CODE] Dim myDirectoryEntry As DirectoryEntry = New DirectoryEntry(String.Format("LDAP://DC=domain,DC=org")) Dim mySearcher As DirectorySearcher … | |
Hi Daniweb. I'm using a file mask (eg '*.txt') to filter filenames in a program that I'm writing. It gets the file mask from an .xml settings file. Currently the mask is '*.xml', and the code I'm using to filter this is like this: [CODE]Pattern.matches(fileMask, fileName);[/CODE] The exception that is … | |
I thought it might be useful to show the special local matching variables that perl uses. Here they are: $1..$9 Contains the subpattern from the corresponding set of parentheses in the last pattern matched like \1..\9 $& Contains the string matched by the last pattern match $` The string preceding … | |
Hello everyone, I am currently working on a code and I got stuck in a part. My algorithm is a text generator that operates on project Gutenberg and its flow is like this: Enter a sentence as input 1-Pick longest word of input sentence 2-Search the longest word of the … | |
I have written a regex that works well except that it always puts the last word on a line of it's own. Can anyone see where I have gone wrong, this is my first attempt at regex. The text is of variable length. Basically my regex is trying to 1. … | |
I have added case 9 into this document and added the appropriate entries elsewhere to make it work however i cannot get this to enter the checkboxes correctly. When i go to the form and I select checkboxes and i list the options and sav ethem, it goes into the … | |
Why this code fails.... ? [CODE] String a = "abcd/dgws"; a.replaceAll("/", "\\"); [/CODE] it results in ...... Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(String.java:558) at java.util.regex.Matcher.appendReplacement(Matcher.java:696) at java.util.regex.Matcher.replaceAll(Matcher.java:806) at java.lang.String.replaceAll(String.java:2000) | |
Hi Guys I wonder if you can help me get my head around this. I am trying to search a String for a sub string but there are not gaps in the original string for example [code] String s1 = "www.google.com/search/" String s2 = "google" [/code] when i attempt to … | |
I have a string contains sequences of 0 and 1. I need to replace all zero sequences whose length less than 5, into number 1 with same length. The zero sequences with length 5 or more should be left as is. For example source : 11000001100010011000001 result : 11000001111111111000001 [CODE] … | |
Hi, I was wondering if it is possible to get a param value with javascript from an java applet. [CODE]<object type="application/x-java-applet" classid="java:Link.class" width="100" height="25"><[COLOR="Red"]param value="http://f0802594f7f84cdaa59017c6588bf486/selif/moc.xnilemil"[/COLOR] name="java"><and many more that isn't needed> [/CODE] So can I get this param value with a javascript method? I couldn' find anything on google so … | |
Hello I am attempting to parse multiple lines of text from a text file using regexpressions. I am using vb.net with visual studio 2008. At the moment I am filling my datatable with the text file information and am able to return each line of text and parse the first … | |
Hello everyone, I am currently working on text processing with Python and I want to parse a .txt file into its sentences as a whole. I tried to create some regular expressions but I failed to do so. I only managed to come up with a regex that splits each … | |
Hi, I need to retrieve anchor tag innerHTML using RegExp in php. Consider I have a syntax like [CODE] <div class="detailsGray"> <span class="detailEmail"> <a href="http://example.com"class="fontLink">examples@mail.com</a></span> </div> [/CODE] here how can we retrieve [email]examples@mail.com[/email] using RegExp and preg_match_all(). Thanks | |
Here's I wrote some code to validate user input without using if\else statements. I believe in scalability is the most important aspect in our problems solution. Let's say we are required to permit only numerics in some text boxes; we shouldn't develop something like that [iCODE]if(((e.KeyChar < '0' || e.KeyChar … | |
Hi, I am looking for a way to split a series of sentences to no longer than 100 characters per line, but with the split being on a white space, so that words are not broken. Is there a regex or some way to do this. Thank you valter | |
I have noticed a few questions popping up from time to time on the subject of formal languages in general, and on regular languages in particular. As I'm pretty bored and enjoy the study of formal languages to a reasonable extent, I thought I might try to give a quick-and-dirty … | |
how do i find a pattern in richtextbox?? the text is like : hello i want to {help|meet|call} you {please|come|soon}. i want to find all such strings which have curly braces and then replace the whole string with any word from within it, RANDOMLY. so on the click of a … | |
hai iam new to jsp.i want to uplad an image to my website .my code is given below. Pls anyone help me ........... thanks in advance [code=java]import com.mysql.jdbc.Connection; import com.mysql.jdbc.Statement; import java.io.*; import java.sql.DriverManager; import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.*; import javax.servlet.http.*; import org.apache.commons.fileupload.*; … | |
Hi everyone, Ive built an email marketing tool and have found that some users when editing the content via the FCK editor they enter in additional parameters. IE = Target class style etc. I currently only want the application to process the href="" content only with the output contining the … | |
[url]http://php.net/manual/en/function.preg-replace.php[/url] [url]http://phpro.org/tutorials/Introduction-to-PHP-Regex.html#1[/url] I have been reading up on php regular expressions. Honestly I don't get it. I think i need to use the above. Here is my problem I am reading a page via php-curl and sending it to a string variable. Now before I send the html code back … | |
HI All, :D I'm computer science student. Would you like to tell me about that problem? Here. 1) RE for accepts all strings of (a,b,c) that contains an odd number of a's. 2)Re for the language of all binary of strings that have at least three symbols and whose first … | |
I'm writing a code that should extract tags from an HTML code (I'm skipping parts about parsing and stuff). I'm testing it using a simple fixed string however, it doesn't remove this <div> tag and I have no idea why... Thanks... [CODE]import re RegExpression_Tags = r"<.*?>" html = """ <div … | |
something like this: open red box with key or open red box to be broken down to open as .group("verb"), red box as .group("object"), with as .group("preposition"), and key as .group("indirectobj") my current pattern is [icode]"^(?P<verb>open)\W*(?P<object>\w*\W{1})\W*(?P<preposition>with|\Z)\W*(?P<indirectobj>\w*)"[/icode] it's not working, and i'm kinda out of ideas. | |
[CODE]<a href=\".\/(viewtopic.php\?f=15&t=[0-9]+)\" class=\"topictitle\">([#\w\s_\-!$%&()?.,'\":;{}\/\\|’=\[\]+\–\â„¢ ]+)<\/a>[/CODE] i have this regex ina ction when i use it in software like regex buddy its ok but when i use it in php it just dont work it .throw no error at all..but it produce zero result. it is made to match this [CODE]<a href="./viewtopic.php?f=15&t=119871" … | |
I have an asp.net web page that a user is loading a file to that I want to parse data out of. The following text is some sample data (I'm told that it's supposed to be .csv but as you can tell, it's really not.) Resource:Wills MD, Robert P; Ward … | |
Hi guys i have java scripts as follows His acquaintance with Elizabeth was very trifling."</p>\n<P class="Sx0x1">"To be sure, Lizzy," said her aunt, "he is not so handsome as Wickham; or, rather, he has not Wickham's countenance, for his features are perfectly good. But how came you to tell me that … | |
Hey the code I have for validating the tel no is not working for the string value (567) 789-5677 [CODE] String rePhoneNumber = @"\([1-9]\d{3}\)\s?\d{3}\-\d{4}$"; Regex re = new Regex(rePhoneNumber); if (re.IsMatch(textBox1.Text)) MessageBox.Show("valid phone number"); else MessageBox.Show("Phone Number Must Be Entered As: (555) 555-1234"); [/CODE] Every time the else part is … | |
I need some help. I have figured out most of my script but I need to search a string and see if it starts with certain characters and Does not end in another. [$line1 = "EB*1**96" #should produce true value and blank line] [if ($line1 =~ /^EB\*/ and $line1 ne … | |
I am banging my head for many hours but still cant ge tit done. Here is the URl [url]http://www.superpages.com/bp/Fords-NJ/Five-Star-Insurance-Agency-LLC-L0001976672.htm?OF=1&C=taxation&lbp=1&TR=2&bidType=FFCLIK&PGID=yp457.8081.1278687125248.17713187910&dls=true&bpp=4[/url] I am trying to match the products and services part and lists that follow. Here what i had tried. [CODE]preg_match(/Services<\/a><\/h3>.*?<a.*?>\(Edit\)</a>\s+<ul>(.*?)</ul>/smi,$data,$store);[/CODE] | |
Ok. I have ZERO PHP Knowledge, still good in editing php and all that stuff. Only know copy paste and have no knowledge what that means. Still would try to explain my problem. I use variable to fetch data from mysql. Ex. my url is [url]http://www.example.com/venue.php?vcity=New[/url] York. Now, I want … | |
![]() | Hi all, I have a phpbb forum that I had to move to a subdirectory (/forum/). We've been going for 8 years so have a lot of stuff indexed on Google etc. Is there a painless way of using .htaccess to send all requests to the subdirectory. The root directory … ![]() |
Hi, I am new to regular expressions, I am having a problem regarding matching a specific keyword in certain condition. [CODE]string regexstring="\\bhtml\\b|[.]net\\b"; Regex rgx = new Regex(regexstring, RegexOptions.IgnoreCase); MatchCollection matcol = null; string st_data = "I am a .net developer, but also know about asp.net, vb.net ; I work on … | |
Look into this xml file: <xml> <head> <title>Something</title> </head> </xml> I need to store all the string from the tags into an array. So my string array is supposed to be [xml,head,title,/title,/head,/xml]. I've tried various methods and read up regular expressions tutorial for C#, but I can't get the string … | |
Hi Guys, I want to store the values of regex.match in an array but i am getting error. my code is as follows [code] string[] subj = null; for (int f = 1; f <= dir.Length; f++) { Match o = Regex.Match(txt1, "section_title='(?<TITLE>.*)'"); subj[f] = o.Groups[1].Value; } } } [/code] … | |
Hello I am writing a script that will replace the src of an image when the user hovers over it. I am using jquery and regex to accomplish this and have tested it on my local server but the src of the images on the live server is different and … | |
I'm writing a script that will search file names looking from certain file extensions. The thing is, is that I am looking for multiple extensions, and the list may change. I could write an if statement using "and", but the line just gets a bit long and can become difficult … | |
Hi all, I am trying to link to an external library (the boost regex library) under gcc. I am ashamed to admit that what I know about linking external libraries comes soley from modified snipets from online forums. My problem is as follows; I use to keep all my source … | |
I have a project where I'm recursing into drives specified by the user and am getting rid of any "invalid" characters defined in a RegEx pattern. I'm very new to this and C#, so any help would be appreciated! If the file contains ANY of these characters: | # { … | |
Here is the java code to search for multiple patterns in multiple lines...i m not able to go back to the previous pattern using this code... try tomake an xsl file in the link provided in folder and give the same pattern somewhere in the xsl...and do tell me the … | |
Sorry for another regex post but i have been trying to get a regex to work to check for unwanted characters in a string like @#?! I have tried [code] var cityreg=/^[^$%@!]+$/; [/code] but it doesn't seem to work? | |
Hi I have been playing with this regex for a few hours now I want to make it so it accepts commas also any ideas? [code] var regname=/^[a-zA-Z\.\-'\s]*$/; [/code] At the moment it works with A-z and - . ' but can't seem to figure out how to include commas … | |
I hope someone can help me with a simple RegEx for a preg_replace. I need to replace something like this [code]0.00|2=399.0000[/code] so I'm only left with the value '2'. Would preg_replace be the most effective method to achieve this result? Another example [code]0.00|13=69.0000[/code] to lift out value '13'. Thank you … | |
Hi guys I am willing to know how to match a website s title using regex. Many thanks in advance | |
Hi Guys, can anyone help me to write a regex function for the following string .So my string is contents=false book_title='The Old Man and His Sons' sections=[ 'The Old Man and His Sons' ] now i want to extract just The Old Man and His Sons so far my code … |
The End.