I have a stylesheet:
a,b,c { stuff
lots of it
}
b { more stuff }
.test { even more }
I want a regular expression to break it up into each of the three parts, separating from '}' to '}' should work alright for my needs (except the first case obviously).
...
I've written a regex pattern to find Fibonacci numbers (it doesn't matter why, I just did). It works wonderfully as expected (see on ideone.com):
String FIBONACCI =
"(?x) .{0,2} | (?: (?=(\\2?)) (?=(\\2\\3|^.)) (?=(\\1)) \\2)++ . ";
for (int n = 0; n < 1000; n++) {
String s = new String(new char[n]);
if...
Can someone help me to validate the following rules using a RegEx pattern
Max length : 15
Minimum length : 6
Minimum character count : 1
Minimum numbers count : 1
Consequent repeated character count : 2
...
I configured my Spring web app with a servlet to serve images at the URL:
/imgsrv?imgid=12345
I also have Sitemesh installed and now when I call this image servlet, I get a decorator exception related to this servlet, which does not need a decorator applied to it.
According to the Sitemesh docs, you can exclude certain URLs from havi...
Hi
I want to generate a search preview of an article by removing certain html nodes including the child node(s) (particularly headers and images) and removing all other tags eg. paragraph while leaving child nodes.
e.g.
"<h2>Subject</h2><p>Subject is the who, what, where, why and when.</p>".gsub(/<\/?[^>]*>/, '')
results in
Subject...
I'm attempting to use String#gsub to add a slash in front of % or ?, which i'll then be using in a LIKE query. I'm getting some odd behaviour which hopefully someone can explain:
irb(main):018:0> "%?".gsub(/([%\?])/, '\1')
=> "%?"
irb(main):019:0> "%?".gsub(/([%\?])/, '\\1')
=> "%?"
irb(main):020:0> "%?".gsub(/([%\?])/, '\\\1')
=> "\\1\...
I have a line that looks like this:
$/Reporting/MSReportin gServices/Alle gro/Ex eXYZ.All egro.Ss rs:
The spaces are tabs, so here is what it actually looks like
$/Reporting/MSReportin gServices/Alle{TAB}gro/Ex{TAB}eXYZ.All{TAB}egro.Ss{TAB}rs:
I have to find the first tab in each line that starts with a $ sign.
How do I do this...
I am trying to replace strings in brackets in some html string. When I use a regular replace, its fast, when I try to create a pattern for global replace, it ends up throwing a stack overflow error. It seems like somewhere along the process path, it converts my single string to an array of characters.
Any ideas?
var o = { bob : 'is cool...
Hi
I am trying to write a regular expression to match any string that satisfies the following criteria.
The string begins and ends with a matching pair of parentheses '(' ')'
There may be any number of parentheses within it.
For example my regex shud match :
( ( p(x)+q(x) ) . (p(x) * q(x) ) )
but not match
( p(x)+q(x) ) . ( p(x...
I have several thousand text strings where the IMDB occures in fairly random positions, but its always in the following format: tt0234215 (tt + some numbers).
What would be the best way to strip it out in php?
...
I'm looking for a regular expression library in .Net that supports lazy evaluation.
Note: I'm specifically looking for lazy evaluation (i.e., the library, instead of immediately returning all matches in a document, only consumes as much of the document as necessary to determine the next match per request), NOT support for lazy quantifie...
I want to find words inside text, where word contains only preselected character set.
For example: I use regex to split on characters not in set and remove entries that are empty
Like:
string inp = @"~T!@#e$мудак%š^t<>is69&.,;((טעראָר))_+}{{男子}[죽은]ที่เดิน:?/Ök\|`'+*-¤=";
string reg[] = {"[^A-Za-zšžõäöüŠŽÕÄÖÜ]"};
foreach (string word...
Hey Guys,
Tried looking around for a regex pattern for a full name and just can't seem to find one.
Ideally would match like
Tom Franklin
tom Franklin
tom franklin
tom franklin-jones
i.e. allow 1 space in the middle and some basic hyphens etc but thats all. Does any one know how to do this ?
Edit: Including
René Hadron van der Öö...
Hello,
I have to extract from a string in visual basic some text, like this:
<div id="div">
<h2 id="id-date">09.09.2010</h2> , here to extract the date
<h3 id="nr">000</h3> , here a number </div>
I need to extract the date from the div and the number all this from within the div...
Also and this will be in loop, meaning there are mo...
Hi,
there is more elegant (pythonic + effective) way to find word on given position?
FIRST_WORD = re.compile(r'^(\w+)', re.UNICODE)
LAST_WORD = re.compile(r'(\w+)$', re.UNICODE)
def _get_word(self, text, position):
"""
Get word on given position
"""
assert position >= 0
assert position < len(text)
# get secon...
Hi All,
I really should polish up on my regex but for now can anyone help with this...
((2,3,4,11,8),(5,44,67,78,32,22,111,234))
as you can see, each range of numbers is comma separated and, in this example, there are 2 ranges of of numbers.
In a live scenario there could be many numbers and a handful of ranges.
So... how do i extr...
I am working on a search and replace console app to help out some people in my department. I am trying to have them input a file path and also the type of file they would like to search for. if they want to find txt files then it will find all txt files in a directory...stick these into an array and then process the files as needed. I...
I'm trying to strip out the street number from a mailing address.
I have a regex in Java:
address.replace("^\\s*[0-9]+\\s+","");
It works on this address:
301 West 23rd Street
making it:
West 23rd Street
But when I apply it to this address, the address is unchanged:
70-50 69th Place
Instead it needs to be:
69th Place
Any ...
What would be the best regular expression for tokenizing an English text?
By an English token, I mean an atom consisting of maximum number of characters that can be meaningfully used for NLP purposes. An analogy is a "token" in any programming language (e.g. in C, '{', '[', 'hello', '&', etc. can be tokens). There is one restriction: Th...
i want to check for certain regex expression to make sure some string is followed by '::' and some number. The number can be between 1 and 999999999999.
for example: 'ACME LOCK & KEY::42443' should pass where 'ABC Inc.' should fail.
any help?
...