306 Topics
| |
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] … | |
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 | |
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 … | |
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 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 … | |
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 … | |
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: | # { … | |
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 … | |
I am planning to use preg_replace to remove some unwanted stuff from dynamic string $mystring: <ul><li><a href="http://www.url.com/wiki/How_to_fix_erection_problems_after_prostate_surgery&diff=335&oldid=prev">How to fix erection problems after prostate surgery</a></li> <li><a href="http://www.url.com/wiki/Wikipenis:Community_Portal&diff=334&oldid=prev">Wikipenis:Community Portal</a></li> </ul> This string is generated from an RSS reader. (The url has obviously been replaced to make sure no one thinks this is … | |
Hello. I just want to know if it's possible to use regular expressions in the match attribute of the template element. For example , suppose i have the follow xml document: <greeting> <aaa>Hello</aaa> <bbb>Good</bbb> <ccc>Excellent</ccc> <dddline>Line</dddline> </greeting> Now the xslt to transform the above document: <xsl:stylesheet> <xsl:template match="/"> <xsl:apply-templates select="*"/> … | |
Ayoo errbody, So i have an array full of strings that I need to apply some regular expressions to and then store the results in another array. What would be the best way to do this? | |
I found this great piece of code for validating URL's. I've been trying to get it to work with preg_match() since eregi() is deprecated with with PHP 5.3: [code=php]// SCHEME $urlregex = "^(https?|ftp)://"; // USER AND PASS (optional) $urlregex .= "([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?"; // HOSTNAME OR IP $urlregex .= "[a-z0-9+$_-]+(.[a-z0-9+$_-]+)*"; // http://x … | |
For this project i need to have the ability to analyze a file containing a number of .NET(3.5) class's from source code.. identify every class and then output each seperate class into their own text file i.e(this is what the file is like, contains a number of class's in it, … | |
I have some random text like: [CODE]>>>text= \ """import sys n = int(sys.argv[1]) ;;print "blbalbalbalabllalbaa" replace me i in range(1,n) {print "numbers:";;replace me j in range(1,3) {print j} ;;print i ;;replace me k in range(1,3) {print k} ;;print "end!"} replace me n < 5 {print n ;;print "youragenious"} """[/CODE] i'd … | |
Okay, so I'm having problems with my code. I've browsed Daniweb and couldn't find any solutions on here that work. I'm extracting 2 sets of texts from a .xml file. The first part is a directory name(eg. "C:\work\") and the second part is the name of a file in that … | |
hey all. I am trying to do validation via PHP for submitted forms. Below is my own code, please comment if its the correct method or not. However, I tried so many ways to have the /n or /r added, but I cant get to it. Its just to make … | |
[CODE] private Map<String , String> c = new HashMap<String , String>(); .... //regx to get mString c.put(mString.group() , mString.group()); ..... //regx to get mNumber c.put(mNumber.group() , mNumber.group()); ....... Set set = c.entrySet(); Iterator i = set.iterator(); while( i.hasNext() ) { Map.Entry me = (Map.Entry) i.next(); System.out.println(me.getKey() + " : " … | |
Hi. I am trying to match a string: "RemoveAcc $k: $v" There are an arbitrary number of spaces between RemoveAcc and the two variables...Preferably I would like to store these to variables using $1 and $2 after the string is parsed, but I do not want to save the RemoveAcc … | |
Hello! =) Please help me with this! =) This is my last one to my diploma work! =) If the user enters a number in the textfield, than JS should set the selection in the textarea to that line. Empty lines are changed to " \n" coz I like for-in … | |
Hi Guys, I'm in need of regular expression for validating the html tags that are closed properly, say for example <i>test content <b>see this </i> .. it should show an alert "tag is incorrect". Plz help me....Guys-:)-:) Thanks in advance | |
Hi all, I don't know whether my question belong here but any ways why every browser has a built-in regex engine? Why they have to find patterns in a http page? | |
Hi there, I am building a blog at the moment i have a amazing script that search a post for the images in it. So i can just setup a post template, call the images that are in the post and go. In this way i put the images unedited … | |
I trying to get text only from html code (no tags and exec) I used the next command (regular expression): htmlSurce = htmlSurce.replaceAll("\\<.*?*\\>", ""); it works fine but all the text between <!-- --> is not removed how can I remove it??? | |
| Hi folks, I'm looking for a function, similar to str_replace that replaces just the first occurance of a specified string. I have found such a function: [url]http://www.help2go.com/Tutorials/Programming/PHP_:_How_to_replace_only_the_first_occurrence_in_a_string_with_str_replace.html[/url] However, this does not take into consideration of 'search from an initial position'. My interest is with regard to replacing strings within a … |
Hey guys, so i've posted here before about regex, and i was told that some of you may be able to check my regexes for errors after i have created them. I have one that looks like it should work to me, but it absolutely will not. [code] public static … | |
Hi, my problem is in regular expression. I need to catch from html code hyperlink tag's href atribute content if this hyperlink contains search condition. here is snippet: [CODE=php]$a = "nail"; //search ctriteria between <a></a> $s =<<<EOF <a class="level2" onmouseout="this.style.background = '';" onmouseover="this.style.background ='#2c7cf4';" href="index.php?item&module=1&category=11" style=""> kaut kas cits </a> … | |
I am having some problems with my java code, i am trying to write a C compiler and am currently working on developing a string tokenizer for the C programming language using java regex. my problem is first my program wont recognize multiline comments and second i cant figure out … | |
Hello all. I have a small problem, the next code finds the neden content, but it doenst print it: [CODE]$string = "#324423asdd asd 'BecamePosters' "; if($string =~ m/'[a-zA-Z]{1,40}'/) { print "ok!\n"; print $1; } else { print "not ok!\n"; }[/CODE] It only prints "ok!\n" but nothing more. Also triyed m/'*'/ … | |
Hi, I have the following regex pattern. I don't think there is anything wrong with it. It seems to work when i test but if someone sees anything wrong with it please feel free to tell me. I don't know Regex but managed to put a username validator together as … |
The End.