I'm trying to split an HTML string by a token in order to create a blog preview without displaying the full post. It's a little harder than I first thought. Here are the problems:
A user will be creating the HTML
through a WYSIWYG editor (CKEditor).
The markup isn't guaranteed to be
pretty or consistent.
The token, read_more(), can
be ...
I'm trying to determine whether or not a string contains a number. This doesn't seem to be working.
static const regex re("([0-9]+)");
cout << regex_match("L5", re);
prints
0
Thanks!!
...
Variable $name (string) gives something like (possible values):
"Elton John"
"2012"
" George Bush"
" Julia"
"Marry III Great"
Want to catch the first letter of $name and add it to $letter variable.
It's important how many words (divided with spaces " ") the string has:
If there is just one word, set $letter to the first letter of t...
hi, i have expressions like :
-3-5
or -3--5
or 3-5
or 3-+5
or -3-+5
I need to extact the numbers , splitting on the "-" sign between them i.e in the above cases i would need,
-3 and 5, -3 and -5 , 3 and 5, 3 and +5 , -3 and +5.
I have tried using this:
String s[] = str.split("[+-]?\\d+\\-[+-]?\\d+");
int len = s.length;
...
HI
I want regex option that find website links like here :
www.yahoo.com
yahoo.com
http://www.yahoo.com
http://yahoo.com
yahoo.jp ( or any domain)
http://yahoo.fr
is there anyway to track them all with regex ?
...
My autocomplete results for each item looks something like this:
<h3>Celebrity Sweepstakes</h3><p>0 episodes</p>
But I want only the title inside the H3 to be highlighted. See the 'highlight' function below. I'm not sure how to change that original RegExp to only replace inside the title.
$(".show_autocomplete").autocomplete("/shows....
Hello Experts. I have a prob. I'm trying to create a custom slugify functiom. I use django.autoslug. Due to autoslug documentation I was able to create a custom slugifier, but it needs to be improved and I do not know how do I realize that.
So I have a string (book title) i.e. .NET Framework 4.0 with C# & VB in VisualStudio 2010. I want...
I need to get info from a website that outputs it between <font color="red">needed-info-here</font> OR <span style="font-weight:bold;">needed-info-here</span>, randomly.
I can get it when I use
start = '<font color="red">'
end = '</font>'
expression = start + '(.*?)' + end
match = re.compile(expression).search(web_source_code)
needed_i...
I'm using a RegEx on an XML dump of a Wikipedia article.
The Regex is = {{[a-zA-Z0-9_\(\)\|\?\s\-\,\/\=\[\]\:.]+}}
I want to detect all the text wrapped with {{ and }}.
But instead of detecting 56 matched which I got from simple search with {{, it only detects 45.
a sample block it doesn't detect is, {{cite journal | last = Heeks | fi...
Please help me to discover whether this is a bug in Python (2.6.5), in my competence at writing regexes, or in my understanding of pattern matching.
(I accept that a possible answer is "Upgrade your Python".)
I'm trying to parse a Yubikey token, allowing for the optional extras.
When I use this regex to match a token without any opti...
I'm parsing a relatively complex expression in Java using regexps + some manual parsing. What I'm doing right now is removing what I've already parsed from the string, so I have the next thing to parse right at the beginning of the string.
I would like to change this so I have a int pos variable and I don't modify the string. However, n...
Hi,
Why does this code not find picture links in text?
$text = 'text text <img src = "http://www.singlewheel.com/Scoots/PAV/Martin7PAV/42316.jpg" /> text text';
preg_match_all('#^http:\/\/(.*)\.(gif|png|jpg)$#i', $text, $all_img);
...
require 'rubygems'
require 'differ'
original = "Epic lolcat fail bellmead drive!"
current = "Epic wolfman fail bellmead dr!"
diff = Differ.diff_by_word(current, original).to_s
puts diff # => "Epic {"lolcat" >> "wolfman"} fail bellmead {"drive" >> "dr"}!
diff =~ /(\{"[a-zA-Z0-9]*" >> "[a-zA-Z0-9s]*"\})/
puts "#{$1} to #{$2} #{...
I have some regexes in a Perl script that are correct but slow. I am considering trying to improve performance by adding extra + operators (ie *+ instead of * and ++ instead of +) to disable backtracking. I tried replacing all of them and the regexes stopped working... so much for the simple solution. How do I know where I can add the...
^[0-1]*1[0-1]*1[0-1]*1[0-1]*$
To match a binary string with 3 or more occurrences of '1'
This expression works...just trying to make it better.
...
Im trying to construct a regular expression to just match if the length of the string is odd. I have not had any success so far.
2313432 - true
12 - false
121111111111111 - true
Thanks
...
I am trying to use Scanner to break up a string that i read in from file.
File data is:
RFH ^@^@^@^B^@^@^@°^@^@^A^Q^@^@^D¸
^@^@^@^@^@^@^D¸^@^@^@
<mcd><Msd>jms_bytes</Msd></mcd>
^@^@^@d<jms><Dst>queue:///panddArchiveVerifyStep1.V001_I</Dst><Tms>1280138410102</Tms><Dlv>2</Dlv>< /jms> 571:8:*SYD01_P,31:*panddArchiveVerifyStep1.V001_I...
SELECT title, title REGEXP 'apple' as is_fruit FROM mytable;
TO:
SELECT title, title REGEXP 'apple' or orange...or grapes...as is_fruit...
Basically, how do I do an "OR" for REGEXP?
...
Hello,
I have the following code:
NSString *text = @"http://bit.ly/111 http://bit.ly/222 http://www.www.www";
NSRegularExpression *aLinkRegex = [NSRegularExpression regularExpressionWithPattern:@".*http://.*" options:NSRegularExpressionCaseInsensitive error:nil];
NSUInteger numberOfMatches = [aLinkRegex numberOfMatchesInString:text opti...
I have problems running the matches XPATH method:
@Test(groups = "regression")
@Parameters( { "baseUri", "locale" })
public void testShopping(String baseUri, String locale) throws Exception{
session().allowNativeXpath("false");
String shoppingLink = session().getAttribute("//div[@id='footernav_links']//a[matches(@href,'.*shoppi...