How can filter variations of the word 'the' using a regex in C#?
I am completely new to writing regular expressions. I am trying to write a Regex that will not allow the following terms in a text box. the The T h e ...
I am completely new to writing regular expressions. I am trying to write a Regex that will not allow the following terms in a text box. the The T h e ...
I need to display a formatted number on a web page using JavaScript. I want to format it so that there are commas in the right places. How would I do this with a regular expression? I've gotten as far as something like this: myString = myString.replace(/^(\d{3})*$/g, "${1},"); ...and then realized this would be more complex than I thi...
I need help putting together a regex that will match word that ends with "Id" with case sensitive match. ...
I have some code that I'm converting from Perl to Java. It makes pretty heavy use of regular expressions, including the s/// operator. I've been using Perl for a long time and am still getting used to the Java way of doing things. In particular, Strings seem more difficult to work with. Does anyone know of or have a Java function tha...
I'm trying to parse (in Ruby) what's effectively the UNIX passwd file-format: comma delimiters, with an escape character \ such that anything escaped should be considered literally. I'm trying to use a regular expression for this, but I'm coming up short — even when using Oniguruma for lookahead/lookbehind assertions. Essentially, all o...
I have a text editor on my web page, on that text editor i put image and than i use that image in different parts of my website, but in different places the image size differs. The image in database is stored this way: <div><img width="210" height="150" alt="" src="/portali/userfiles/image/Kategorite/Teknologji/-1.jpg" /></div> Now in...
In Python I can use re.findall(pattern, string) to return all non-overlapping matches of pattern in a string. For example, in the following SVG path command: import re spam = "M317.0,169.7C311.1,170.5 285.7,146.8 300.7,178.57 L 321.4,175.01" eggs = re.findall("([A-Za-z]|-?[0-9]+\.?[0-9]*(?:e-?[0-9]*)?)", spam) print(eggs) ['M', '317.0'...
Hi, I have a word list, but it has some words like East's I need to find the words, those only contain a-z and A-Z, from a word list. How to do that. I am using grep. What should I put after grep grep *** myfile.txt Thanks! ...
I was reading through some of the responses in this question and saw that a few people said that recursive regular expressions were not strictly speaking regular expressions. Why is this? ...
I have an html file that I need to take any tag and put an align='left' into it. So given the line : <td><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td> I need it to do : <td align='left'><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td> If it already specifies an alig...
In Ruby, I'd like to convert a slash-separate String such as "foo/bar/baz" into ["foo/bar/baz", "foo/bar", "foo"]. I already have solutions a few lines long; I'm looking for an elegant one-liner. It also needs to work for arbitrary numbers of segments (0 and up). ...
I have a whole array of regexp queries to make recursively going through the string in order. Is there a way I can do it all with 1 call such as (doesn't work)? str.replace(/query1|query2|query3|query4|...|[0-9]+|[^]/, "reslt1|reslt2|reslt3|reslt4|...|procNumb|procChar"); It need only work in Firefox. Right now I'm stuck...
In the following code, if the string s is appended to be something like 10 or 20 thousand characters, the Mathematica kernel seg faults. s = "This is the first line. MAGIC_STRING Everything after this line should get removed. 12345678901234567890123456789012345678901234567890123456789012345678901234567890 1234567890123456789012345678901...
I use matching URLs in a part of my code. Now I use regular expressions for this. This is fine, but does not always produces "nice", simply readable patterns. Is there any language defined for matching URLs? It should be like this: http://*.example.com/* so simply wild-cards and things useful for URL would be there. The best would if th...
I'm trying to add conditional logic to determine if there's one regex match for a URL in a string. Here's an example of the string: string_to_match = "http://www.twitpic.com/23456 ran to catch the bus, http://www.twitpic.com/3456 dodged a bullet at work." I only want to match if I determine there's one URL in the string, so the above...
I'm trying to replace \" (backslash doouble quote) by ' (quote) using sed. sed "s/\\\"/\'/g" file.txt The command doesn't work as expected. It replaces all the " in the text file, not only the \". It does the same thing as sed "s/\"/\'/g" file.txt I'm working on Mac OS X Leopard. Does any one have a clue? ...
if(!preg_match("/[a-zA-Z'-]/",$First)) { die ("invalid first name");} the above only flags input as invalid when the field is all numeric. combinations of letters and numbers pass ok. Some help here for a newby please. thanks. ...
Hi all, I'm looking for a bit of help with a regex in python and google is failing me. Basically I'm searching some html and there is a certain type of table I'm searching for, specifically any table that includes a background tag in it (i.e. BGCOLOR). Some tables have this tag and some do not. Could someone help me out with how to wr...
Hi, Take the following URI: http:\/\/.*\.google\.com/search/results\.php* I am simply trying to match all single forward slashes ( / ) between two alphanumeric characters in a given URI. In the case above, the two just before search and results. Could you point me in the right direction? EDIT The intention is to do search and repla...
I have a regex: /abc(def)ghi(jkl)mno(pqr)/igs How would I capture the results of each parentheses into 3 different variables, one for each parentheses? Right now I using one array to capture all the results, they come out sequential but then I have to parse them and the list could be huge. @results = ($string =~ /abc(def)ghi(jkl)mno(...