I'm not an expert on regular expressions so I thought I'd throw this question out. I'm thinking regular expressions can help make my tests more robust (testing generated EJB QL statements for correct generation).
For example:
select u.firstName, u.lastName from Users u where u.age > 50
What regex do I use to split it into the followin...
I have following string:
"Test, User" < [email protected] >, "Another, Test" < [email protected] >, .........
I want following result:
array(
array('name' => 'Test, User', 'email' => '[email protected]'),
array('name' => 'Another, Test', 'email' => '[email protected]'),
...........
)
...
I'm trying to select all text in-between following a specific pattern:
Sample Text:
"by thatonekid (Posted Mon Jan 12, 2009 7:17 pm)
fell onto the trail right below one of the most traveled walls at the point! yikes!
"
Every text I work on will start with: "by USERNAME (Posted DATE) <br /> theTextIWant"
I thought about exploding on...
Hi,
I'm writing a small blog module. I want the users to be able to type BBCode. I need to convert that to XHTML to store in the DB, which I managed to do for most of the tags, except for [url].
There are two cases I want to allow:
[url=http://stackoverflow.com/]
which should be converted to
<a href="http://www.stackoverflow.com"&g...
Hi! I'm newbie in Python. I can't understand why this code does not work:
reOptions = re.search(
"[\s+@twitter\s+(?P<login>\w+):(?P<password>.*?)\s+]",
document_text)
if reOptions:
login = reOptions.group('login')
password = reOptions.group('password')
I'm having an error:
IndexError: no such group
With document_text...
I have a table called cartypes which currently has 2 fields: id & type. I am adding subtype and I want to move the contents after the dash - from the field called type and put those contents into subtype. Disposing of the dash (any extra whitespace too for that matter). What's the best SQL query for this?
before:
id type ...
I have thousands of files that I need to rename with the following format.
2008:09:18:17:45:48-alfanumeric-alfanumeric.wav the first part is a date.
Ex. 2008:09:18:17:45:48-703-s.wav
A want to rename it to:
20080918.174548.703.s.wav
Basically to remove the ':' and to make a more human readable format and easier to split.
I know that...
Hi
Wonder if anyone can help me out with a little cron issue i am experience
The problem is that the load can spike up to 5, and the CPU usage can jump to 40%, on a dual core 'Xeon L5410 @ 2.33GHz' with 356Mb RAM, and I'm not sure where I should be tweaking the code and which way to prevent that. code sample below
//Note $productFi...
I am trying to parse a list of items which satisfies the python regex
r'\A(("[\w\s]+"|\w+)\s+)*\Z'
that is, it's a space separated list except that spaces are allowed inside quoted strings. I would like to get a list of items in the list (that is of items matched by the
r'("[\w\s]+"|\w+)'
part. So, for example
>>> parse('foo "bar ...
Hey guys, given a data set in plain text such as the following:
==Events==
* [[312]] – [[Constantine the Great]] is said to have received his famous [[Battle of Milvian Bridge#Vision of Constantine|Vision of the Cross]].
* [[710]] – [[Saracen]] invasion of [[Sardinia]].
* [[939]] – [[Edmund I of England|Edmund I]] succ...
(I'm escaping all my quotes, which may make it difficult to read)
I need to match a string that begins and ends with the same character in flex...I know the long hand way (RE being - \"a[^(a\")]a\" | \"b[^(b\")b\" | etc...), but I'm positive this isn't what I'm required to do (midterm tomorrow!);
I need to do this in flex, but if you c...
My basic intention is to find out whether a dir say A is immediately inside dir B or not. I'm checking it in java so I'm using Pattern and Matcher classes.
let say homeDir = /aa/bb/cc (home dir)
dirB = /aa/bb/cc/dd/ee (not immediately inside home dir)
dirC = /aa/bb/cc/dd (immediately inside home dir)
dirD = /aa/f...
Let's say:
/(a|b)/ vs /[ab]/
...
Hello everyone,
I want to capture word "assignment" only when it is found at the begining of line and line ends after that word.There can be zero or more space characters after "assignment" word and characters like : or # or - might come.
For example following lines should match
Assignments
or
Assignments :
or
assignments
Whe...
I'm looking for a regular expression to validate hex colors in asp.net C#. and also looking code for validate in server side
For instance: #CCCCCC
...
What is the correct way to parse a string using regular expressions in a linux shell script? I wrote the following script to print my SO rep on the console using curl and sed (not solely because I'm rep-crazy - I'm trying to learn some shell scripting and regex before switching to linux).
json=$(curl -s http://stackoverflow.com/users/fl...
What is the correct regular expression to use to validate a date like. 2009-10-22 or 2009-01-01 etc. Platform PHP
...
Hello everyone,
Once again I have hit the wall.
How to replace escape characters using regular expressions?
If tab character (\t) occures more than twice, I want to replace those two or more occurances by single \t.
For example if \t\t\t comes, then I want to replace it with \t only.
How to do this?
I am facing one more problem regard...
I have a text file with ; used as the delimiter. The problem is that it has some html text formating in it such as > Obviously the ; in this causes problems.
The text file is large and I don't have a list of these html strings, that is there are many different examples such as $amp;. How can I remove all of them using python.
The fil...
how can i find multiple occurrence of the same character?
something like:
$maxRepeat = 3;
"pool" passes
"poool" don't
i need this to work for any character, so i guess I'll have to escape special characters like . and \
which characters i have to escape?
do you know any good reference to preg_match regexp apart from the one on php...