What could be going wrong here? The problem seems to be with the regex match statement. without it the alerts come, but as soon as I put it in everything goes quiet. Thanks so much! the wildcard is simply to help pinpoint the problem, it is NOT the objective, i do need regex.
window.addEventListener("load", function() { myExtension.init...
Hi,
I want to replace a link with its innerHTML, how is it done?
Example:
Bla bla bla <a href="#nogo">No link here</a> bla bla bla
has to become
Bla bla bla No link here bla bla bla
Tried to replace the node with its innerHTML but I can't get the text in the node itself..
I guess I have to work with regular expressions but I can...
Hi there
I'm trying to capture parts of a multi-lined string with a regex in Scala.
The input is of the form:
val input = """some text
|begin {
| content to extract
| content to extract
|}
|some text
|begin {
| other content to extract
...
I'm trying to retrieve specific tags with their content out of an xhtml document, but it's matching the wrong ending tags.
In the following content:
<cache_namespace name="content">
<content_block id="15">
some content here
<cache_namespace name="user">
<content_block id="welcome">
Welcome Apiko...
I am writing a script to reverse all genders in a piece of text, so all gendered words are swapped - "man" is swapped with "woman", "she" is swapped with "he", etc. But there is an ambiguity as to whether "her" should be replaced with "him" or "his".
...
Does anyone with more knowledge than me about regular expressions know how to split up html code so that all tags and all words are seperated ie.
<p>Some content <a href="www.test.com">A link</a></p>
Is seperated like this:
array = { [0]=>"<p>",
[1]=>"Some",
[2]=>"content",
[3]=>"<a href='www.test.com'>,...
I want to be able to detect (using regular expressions) if a string contains hebrew characters both utf8 and iso8859-8 in the php programming language. thanks!
...
I'm starting to learn Regular Expressions and I want to know: In which cases is better to use them?
...
A little stuck here. I have a simple question I guess.
Given the following input:
content {c:comment comment}this is actual content{c:comment etc} content
I need a way to get the content and comments seperated, but I need to now the order of them. So a simple regex doesn't work.
I want to get this:
content
{c:comment comment}
...
Hi guys!
Help with regular expressions needed. I'm trying using regular expressions and preg_match_all find blocks <character>...</character>. Here is how my data looks like:
<character>
杜塞尔多夫
杜塞爾多夫
<div class="hp">dùsàiěrduōfū<div class="hp">dkfjdkfj</div></div>
<div class="tr"><span class="green"><i>г.</i></span> Duesseldorf ...
I want to split alpha-numeric (with space) and non-alpha-numeric by comma in a string.
I tried with this...
$str = "This is !@#$%^&";
preg_replace("/([a-z0-9_\s])([^a-z0-9_])/i", "$1, $2", $str);
But I got this result...
This, is, !@#$%^&
How can I fix the search pattarn to get this result?
This is, !@#$%^&
Thanks.
...
Is there a way to pass a variable into a regex in jQuery/Javascript?
I wanna do something like:
var variable_regex = "bar";
var some_string = "foobar";
some_string.match(/variable_regex/);
In Ruby you would be able to do:
some_string.match(/#{variable_regex}/)
Found a useful post:
http://stackoverflow.com/questions/185510/how-can...
Hi All,
I have this simple regex replace based routine, is there anyway to improve its performance (and maybe also its elegance?)
public static string stripshrapnel(string str)
{
string newstr = str.Trim();
newstr = Regex.Replace(newstr, @"-", "");
newstr = Regex.Replace(newstr, @"'", "");
newstr = Regex...
I am trying to convert as following:
bool foo(int a, unsigned short b)
{
return pImpl->foo(int a, unsigned short b);
}
to:
bool foo(int a, unsigned short b)
{
return pImpl->foo(a, b);
}
In other words, I need to remove the type definition on the lines which are not the function definition.
I am using Linux.
The following ...
What is a regexp that accepts everything over the language {0,1} but has no substring 110 or 101?
Accept:
111111
000011111
100001000001001
010
1
Reject:
100110
010100
123
Edit: Per comments on answers below, this question is asking for a formal regular expression.
...
I'm trying to count the number of tags in the 'soup' from a beautifulsoup result. I'd like to use a regular expression but am having trouble.
The code Ive tried is as follows:
reg_exp_tag = re.compile("<[^>*>")
tags = re.findall(reg_exp_tag, soup(cast as a string))
but re will not allow reg_exp_tag, giving an unexpected end of regular...
I have a file with the following pattern (please note this is a file generated using sed,
awk, grep etc processing). The part of file input is as follows.
filename1,
BASE=a/b/c
CONFIG=$BASE/d
propertiesfile1=$CONFIG/e.properties
EndOfFilefilename1
filename2,
BASE=f/g/h
CONFIG=$BASE/i
propertiesfile1=$CONFIG/j.properties
EndOfFilef...
Is there a more succinct/correct/pythonic way to do the following:
url = "http://0.0.0.0:3000/authenticate/login"
re_token = re.compile("<[^>]*authenticity_token[^>]*value=\"([^\"]*)")
for line in urllib2.urlopen(url):
if re_token.match(line):
token = re_token.findall(line)[0]
break
I want to get the value of the i...
I have of word documents filled with this type of lines
word = home
fig = tree
car = yatch
I want to select the white space between the end of the first word and the = sign. There is a search and replace feature in word but I can't figure out the regex that will select those spaces. Any help is appreciated.
...
Example:
\Doe, John\" <15553775555>"
The regex is \<(.*?)> and match <15553775555>. But it would be more accurate if it would return only what is inside the < >. How can we modified it to have what's inside? (By the way, what's inside can be not only a 12 digits...
...