Nice and (hopefully) easy. I am trying to work out how to grab the variable #XXX from a text file (css file) containing strings like
hr { margin: 18px 0 17px; border-color: #ccc; }
h1 a:hover, h2 a:hover, h3 a:hover { color: #001100; }
Which I would like to return as
ccc
001100
The plan then is to throw this throug...
Let us say that I have a string "ABCDEF34GHIJKL". How would I extract the number (in this case 34) from the string using regular expressions?
I know little about the regular expressions, and while I would love to learn all there is to know about it, time constraints have forced me to simply find out how this specific example would wo...
I am using this pattern and matching a string.
String s = "//name:value /name:value";
if (s.matches("(//?\\s*\\w+:\\w+\\s*)+")) {
// it fits
}
This works properly.
But if I want to have a string like "/name-or-address:value/name-or-address:value" which has this '-' in second part, it doesn't work.
I am using \w to match A-Za-z_, but...
How can I match a pattern in regex that can contain anything (letters,numbers,...) but matches only if it contains an underscore?
Basically I want to match bob_hello but not bobhello.
...
Is it possible to use a back reference to specify the number of replications in a regular expression?
foo= 'ADCKAL+2AG.+2AG.+2AG.+2AGGG+.G+3AGGa.'
The substrings that start with '+[0-9]' followed by '[A-z]{n}.' need to be replaced with simply '+' where the variable n is the digit from earlier in the substring. Can that n be back refer...
I'm not very good at regex but maybe there's a simple way to achieve this task.
I'm given a string like "bla @a bla @a1 bla"
I'm also given pairs like {"a", "a2"} , {"a1", "a13"}, and I need to replace @a with @a2 for the first pair, and @a1 with @a13 for the second one.
The problem is when i use String.Replace and look for @a, it als...
I have a text field and am looking to have if be valid for all values other than "NONE" without the quotes. I know a comparison would be easy but the system I am using only validates via RegEx expressions. What would the RegEx expression be for it?
...
Hello everyone!
I have the following regexp:
(?P<question>.+(?<!\[\[))
It is designed to match hello world! in the string hello world! [[A string typically used in programming examples]]
Yet I just matches the whole string, and I can't figure out why. I've tried all flavors of lookaround, but it just won't work...
Anyone knows how ...
I'm using regex to match all non-quoted property names in my json files. Eclipse has no problem finding the desired matches, but when I want to replace the matched strings with "$2", I get this error: Match string has changed in file filename.json. Match skipped
Here's the regex I'm using:
((\w+)\s*(?!['"])(?=:))
Any idea on how to w...
Alright guys, I really hurt my brain over this one and I'm curious if you guys can give me any pointers towards the right direction I should be taking.
The situation is this:
Lets say, I have a collection of strings (let it be clear that the pattern of this strings is unknown. For a fact, I can say that the string contain only signs fr...
I'm a newbie to regular expressions and I have the following string:
sequence = '["{\"First\":\"Belyuen,NT,0801\",\"Second\":\"Belyuen,NT,0801\"}","{\"First\":\"Larrakeyah,NT,0801\",\"Second\":\"Larrakeyah,NT,0801\"}"]'
I am trying to extract the text Belyuen,NT,0801 and Larrakeyah,NT,0801 in python. I have the following code which is...
Hello all,
I'm trying to parse some returned html (from http://www.google.com/movies?near=37130 )to look for currently playing movies. The pattern I'm trying to match looks like:
<span dir=ltr>Clash of the Titans</span>
Of which there are several in the returned html.
I'm trying get an array of the movie titles with the following c...
I have the following HTML snippet
<tr>
<td class="1">...</td>
<td class="2">...</td>
<td class="3">...</td>
<td class="4">...</td>
</tr>
etc...
I basically have N rows, and each row contains 4 TD's each with a unique class.
I would like a simple way to split out all the rows and TD's by class so I can choose what data I want to use.
...
Hello.
Suppose I have a string 04032010.
I want it to be 04/03/2010. How would I insert the slashes with a regex?
...
I am trying to match an expression of type
field:"value"
but not
field:value
I have written
([a-z]+)\s*?:\s*?"(.+)"\s*?
and this works excepts in dotNet
Is there any reason why this might be? Something I am missing?
Edit -- I typed the question wrong (figures)
I'm trying to match
field:value
but not
field:"value"
...
Hello, I am using Perl Regular expressions.
How would i go about ignoring white space and still perform a test to see if a string match.
For example.
$var = " hello "; #I want var to igonore whitespace and still match
if($var =~ m/hello/)
{
}
...
Hello,
I want to match a date in the format day/month/year. where day is two digits month is two digits and year is four digits. Also, I want to check see if it is a valid date, for example knows when is leap year, and know which month has 30days, 31days and 28, or 29 days for Februrary.
...
How do I match an URL string like this:
img src = "http://stackoverflow.com/a/b/c/d/someimage.jpg"
where only the domain name and the file extension (jpg) is fixed while others are variables?
The following code does not seem working:
Pattern p = Pattern.compile("<img src=\"http://stachoverflow.com/.*jpg");
// Create a matcher wit...
Extract the number after #/ from my string: abcdefg#/123.
...
Does [_\s^"] mean underscore and whitespace but not " (quote) in Reg
I understand that the brackets ([ ]) mean character range and that ^ means but not, but my question is can you say [this^notthat] or do I have to separate them into two sets of brackets?
...