Is it possible to do string negation in regular expressions? I need to match all strings that do not contain the string "..". I know you can use ^[^\.]*$ to match all strings that do not contain "." but I need to match more than one character. I know I could simply match a string containing ".." and then negate the return value of the...
I am trying to write a regular expression string match in vb.net. The condition that I am trying to implement is that the string should contain only alphabets and must contain atleast one letter of both lower and upper case. i.e AAA-fail, aaa-fail, aAaA-pass.
The regular expression that I have come up with is "^(([a-z]+[A-Z]+)+|([A-Z]+[...
I would need to remove anything between XML tags, especially whitespace and newlines.
For example removing whitespace and newslines from:
</node> \n<node id="whatever">
to get:
</node><node id="whatever">
This is not meant for parsing XML by hand, but rather to prepare XML data before it's getting parsed by a tool. To be more s...
I have a string that is randomly generated:
polymer_str = "diol diNCO diamine diNCO diamine diNCO diamine diNCO diol diNCO diamine"
I'd like to find the longest sequence of "diNCO diol" and the longest of "diNCO diamine". So in the case above the longest "diNCO diol" sequence is 1 and the longest "diNCO diamine" is 3.
How would I go...
On a blog I wish to pass all of the text for a blog entry through a PHP script to process quotes and some other items into nice typographic characters.
The blog text in question contains HTML, and in particular will highlight code snippets contained within <pre><code> ... </code></pre> blocks. The code blocks can appear randomly and in ...
I've noticed some code that uses the static method:
Regex.IsMatch([someRegexStr], [someInputStr])
Is it worth replacing it with the instance method? Like:
private readonly Regex myRegex = new Regex([someRegexStr]);
...
myRegex.IsMatch([someInputStr]);
...
I want to replace the question mark (?) in a string with some other words. What is the regular expression for question mark.
For example, I want to replace question mark in "word=?" to something else, say "stackoverflow". Then the result would be "word=stackoverflow".
What is the syntax in java?
...
Hi all
I got a regex-validator on my asp.net page, which validates a password. The regex is
^(?=.*[0-9])(?=.*[a-zæøåA-ZÆØÅ])[a-zA-ZæøåÆØÅ0-9]{6,}$
.. Now, it works fine in IE8 and FF3, but it validates to false no matter what I try in IE7. Are there any knows bugs, I should know about here? :S
Thanks in advance..
...
Often, I would like to build up complex regexps from simpler ones. The only way I'm currently aware of of doing this is through string operations, e.g.:
Year = r'[12]\d{3}'
Month = r'Jan|Feb|Mar'
Day = r'\d{2}'
HourMins = r'\d{2}:\d{2}'
Date = r'%s %s, %s, %s' % (Month, Day, Year, HourMins)
DateR = re.compile(Date)
Is anybody aware o...
The set-up
A mysql table called "mytable" has a VARCHAR field "data".
The field contains a string in the format of:
name1'value1''name2'value2'' ... nameN''valueN
I'm aware this data is denormalized -- I've been forced to use ' as the delimited since this is the only character that is not allowed as a name or value.
Here are some ...
For example, I have a string :
/div1/div2[/div3[/div4]]/div5/div6[/div7]
Now I want to split the content by "/" and ignore the content in the "[ ]".
The result should be:
div1
div2[/div3[/div4]]
div5
div6[/div7]
How can I get the result using regular expression? My programming language is JavaScript.
...
Now, I'm writing VS 2008 Macro for replace Assembly version in AssemblyInfo.cs file. From MSDN, Assembly version must be wrote by using the following pattern.
major.minor[.build[.revision]]
Example
1.0
1.0.1234
1.0.1234.0
I need to dynamically generate build number for 'AssemblyInfo.cs' file and use Regular Expression for repla...
Hi,
I have the following lines in a files:
a class="rss tip" rel="direct" title="Linq2Sql" href="http://feeds2.feedburner.com/pippo_ORM"></a>
a class="rss tip" title="ORM" href="http://feeds2.feedburner.com/pippo_ORM" rel="nofollow"></a>
a class="rss tip" rel="boh" title="Nhibernate" href="http://feeds2.feedburner.com/pippo_ORM...
I want to replace a string in HTML page using JavaScript but ignore it, if it is in an HTML tag, for example:
<a href="google.com">visit google search engine</a>
you can search on google tatatata...
I want to replace google by <b>google</b>, but not here:
<a href="google.com">visit google search engine</a>
you can search on <b>googl...
I'm building a little Twitter thing in PHP and I'm trying to parse URLs, @replies and #hashtags and make them into clickable links.
The @replies would link to http://twitter.com/replies
#Hashtags would like to http://search.twitter.com/search?q=%23hashtags
I've found a class for parsing URLs and I'm wondering if this could also be u...
Hello!
I wrote a regular expression in hope that I will be able to replace every match (that is just one char) to upper case char. I am using EditPad Pro (however I am willing to use any other tool that would allow me to do this, as long as it is free to try, since I only need to do this once).
Background: I have a very long text file ...
The below regex requires that the password has 1 number, 1 char (upper or lower) and is a minimum of 8 in length. But if I type in a special char it returns false. I don't want to require a special char, but i want to allow it in this context. How can I alter this regex to allow a special char?
Regex.IsMatch(Password, "^(?=.*[0-9])(?=...
I would like to match patterns on strings like on the following ant documentation. Is there a gem already for this or is this an easy task with regexps?
I know Dir.glob already does this but I don't know how to use it without a real filesystem.
'*' matches zero or more characters, '?' matches one character.
In general, patterns ar...
When signing up for new accounts, web apps often ask for the answer to a 'security question', i.e. Dog's name, etc.
I'd like to go through our database and look for instances where users just mashed the keyboard instead of providing a legitimate answer - this is a high indicator of an abusive/fraudulent account.
"Mother's maiden name?"...
Hi,
I can't figure out how to search for a string containing something like "[1]", for some reason this doesn't work:
var regExp = '/\[[1-9]\]/';
var search = string.search(regExp); // returns -1
I've searched all over for a solution but can't find anything...
...