Getting two different words as part of in a regular expression
I want to catch say
"This Text" and "This Somethingelse"
I currently have
\s*This\sText.*
but I am trying to catch both "Text" and "Somethingelse"
I am somewhat new to regular expressions but have looked at this and am stumped. Any ideas?
...
I have a function, call it f, that takes a string and returns a string.
I have a file with lines that look like this:
stuff:morestuff:stuff*:otherstuff:otherstuff*\n
Colons only appear as delimiters and * only appears at the end of each word. I want to loop over the file and replace all instances of stuff* with f(stuff). The previou...
I would like to validate and extract the hours and minutes from a string using Regex in .NET.
Just to recuperate the two numbers, separated(or not) by :. Accepted format
h:m or m. Unaccepted :m, h:.
EDIT:
This is to note, that the number of hours could overflow the 23 till... 32.
The overflow for hours(over 32) and minutes(over 59) I w...
Hi
I want to parse content from
<td>content</td>
and
<td *?*>content</td>
and
<td *specific td class*>content</td>
How can i make this with regex, php and preg match?
...
Suppose I have a file containing lines I'm trying to match against:
foo
quux
bar
In my code, I have another array:
foo
baz
quux
Let's say we iterate through the file, calling each element $word, and the internal list we are checking against, @arr.
if( grep {$_ =~ m/^$word$/i} @arr)
This works correctly, but in the somewhat possi...
Hey all, I was wondering if any knew of a way to use a regular expression or wildcard operator (or pehaps '%LIKE%' in SQL) so I could use JSONPath to do searching within a large set of JSON data.
For instance (and yes, I'm parsing, not eval( )ing my data in the app):
var obj = eval ( '({ "hey": "can you find me?" })' );
And I'd like ...
I have been banging my head against the keyboard in search of enlightenment through Google and all Python docs I could get my hands on, but could not find an answer to an issue I'm encountering.
I have the following regex that I run against a website, but Python insists in setting re.DOTALL on it, even though my code does not tell it to...
hi,
suppose i have the following in a text file (or dired buffer) open in emacs:
file_01.txt
file_02.txt
...
file_99.txt
I want to query-replace or replace the files to
01_file.txt, etc.
I want to use query-replace-regexp or replace-regexp, but don't know what to put in. The search part i put in "file_..", but the ".." are read as pe...
Hi,
Is there any way to create the regex /func:\[sync\] displayPTS/ from string func:[sync] displayPTS?
The story behind this question is that I have serval string pattens to search against in a text file and I don't want to write the same thing again and again.
File.open($f).readlines.reject {|l| not l =~ /"#{string1}"/}
File.open(...
application = webapp.WSGIApplication(
[(r'/main/profile/([a-f0-9]{40})', ProfileHandler)],
debug=True)
The regex in the above parameter will not recognize a 40 hex long hexdigest in Google App Engine.
I'm getting 404s instead of ProfileHandler being passed the matching 40 hex long profile ID. My app.yaml passes everything /mai...
I need to extract a set of characters in of a string. I plan on usng the RegEx.Match method (c#) but I am unclear about the RegEx pattern to use. I want to extract a pattern where it starts with // and ends with ...
Then length needs to be variable inside the matched string but the start and end characters will always be the same. In...
I'm thinking there has got to be a cleaner way to check if a regular expression is not nil / is true. This is what I have been using:
hold = (h4.text =~ /Blah/)
if !hold.nil?
...
end
I tried: !(h4.text =~ /Blah/).nil? but it did not seem to work.
...
I need a a regular expression to validate Zipcode or postcode - it must be 8 characters
alphanumeric field i.e allow A-Z, a-z, or 0-9.
Thanks.
...
I need a Regular Expression for "Atleast 6 characters with no spaces"
Please help
...
Hi all,
I have an interesting problem. I need to analyse a source code and to determine the types of variables before it is compiled. So, Reflection cannot be used!
There are only five types:
double x = 1.23;
long x = 3;
string s='Hello World!'
bool b=true
object[] A = [1, 1+2, 'Hello', s]
An example of ...
Hi there,
I have a directory structure like so:
directory1
- directory2
- <other files I want to be hidden>
I want to allow the user access to directory 2, but disallow access to directory 1. For example:
http://website/directory1 = 404 / Forbidden
http://website/directory2 = Routes to directory1/directory2 and shows files.
I mana...
I've loaded an HTML doc into a string with .NET. I have this REGEX which I can use to match URLs and replace them, but I need only to match ONLY URLs that are NOT fully qualified.
If this is my string:
djdjdjdjdjdj src="www.example.com/images/x.gif" dkkdkdkdk src="/images/x.gif
My result result would look like this:
djdjdjdjdjdj sr...
Hi There,
I hope there is someone who can help me with this regex
content.match(/<div class="content">.+#-#/ig);
I need to match everything between the <div class="content"> [ Match everything inbetween ] up untill the #-# in the coding
I am using javascript
Thanks
...
I want to validate a number. This number must be from -99.99 to +99.99 but except 0 (zero).
I came up with this RegEx expression
[-+]?((\d{1,2}\.?\d{0,1}[1-9])|(\d{0,1}[1-9]))
but it does not handle number of this type:
x0
xy.00
Any idea?
Edit:
I am trying to do a restriction for xsd file.
...
I have a bunch of files (in the hundreds) that have img tags like the following:
<img randomAttr1="randomVal" randomAttr2="valueRand" border="0"
randomAttr3="someRandValue">
I'm trying to do a search and replace operation in Visual Studio 2005 that will identify a tag as an <img>, but only match the border="0" potion of the stri...