var pattern = /^0+$/;
My guess is this:
"Take a look at both the beginning and the end of the string, and if there's a pattern of one or more zeros at the beginning and the end, then return that pattern."
I'm sure that's wrong, though, because when I run the expression with this string:
var string = "0000009000000";
It comes up nu...
I'm trying to split a string with all non-alphanumeric characters as delimiters yet Java's String.split() method discards the delimiter characters from the resulting array. Is there a way to split a string like the "\W" regex pattern does, yet keep the delimiters?
...
I want to write a regular expression that will replace the word Paris by a link, for only the word is not ready a part of a link.
Example:
i'm living <a href="Paris" atl="Paris link">in Paris</a>, near Paris <a href="gare">Gare du Nord</a>, i love Paris.
would become
i'm living.........near <a href="">Paris</a>..........i ...
Is it possible to skip a couple of characters in a capture group in regular expressions? I am using .NET regexes but that shouldn't matter.
Basically, what I am looking for is:
[random text]AB-123[random text]
and I need to capture 'AB123', without the hyphen.
I know that AB is 2 or 3 uppercase characters and 123 is 2 or 3 digits...
currently I have the following code:
String select = qry.substring("select ".length(),qry2.indexOf(" from "));
String[] attrs = select.split(",");
which works for the most parts but fails if given the following:
qry = "select a,b,c,DATETOSTRING(date_attr_name,'mm/dd/yyyy') from tbl_a";
what I'm looking for is the regex to feed to S...
I want to use input from a user as a regex pattern for a search over some text. It works, but how I can handle cases where user puts characters that have meaning in regex? For example, the user wants to search for Word (s): regex engine will take the (s) as a group. I want it to treat it like a string "(s)" . I can run replace on use...
I'm looking to convert the following mod_rewrite rule to the Nginx equivalent:
RewriteRule ^foo/(.*)$ /bar/index.php?title=$1 [PT,L,QSA]
RewriteRule ^foo/*$ /bar/index.php [L,QSA]
So far I have:
rewrite ^foo/(.*)$ /bar/index.php?title=$1&$query_string last;
rewrite ^foo/?$ /bar/index.php?$query_string break;
The problem is (I think...
Does anyone know of any JavaScript libraries that support Unicode-aware regular expressions? For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation etc.
...
I am new to JQuery and am using the JQuery validation plugin. Great stuff!
I want to migrate my existing ASP.NET solution to use JQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator.
I want to be able to do something like this:
$("Textbox").rules("add", { regularExpression: "^[a-zA-Z...
Hi, I have a snippet looking something like the below.
string bodyTypeAssemblyQualifiedName = "XXX.XX.XI.CustomerPayment.Schemas.r1.CustomerPayments_v01, XXX.XX.XI.CustomerPaym" +
"ent.Schemas.r1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac564f277cd4488" +
"e";
I'd like use regular expression in...
Hi all,
I am not that hot at regular expressions and it has made my little mind melt so what.
I am trying to find all the tables names in a query. So say I have the query:
SELECT one, two, three FROM table1, table2 WHERE X=Y
I would like to pull out "table1, table2" or "table1" and "table2"
But what if there is no where statement....
I have a client which is shipping via UPS, and therefore cannot deliver to Post Office boxes. I would like to be able to validate customer address fields in order to prevent them from entering addresses which include a PO box. It would be best if this were implemented as a regex so that I could use a client-side regex validation control ...
I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to add a string before each line and after each line.. So that:
wordone
wordtwo
wordthree
become
able:"wordone"
able:"wordtwo"
able:"wordthree"
How can I do this?
...
I'm trying to insert a comment character into a string something similar to this:
-CreateVideoTracker VT1 "vt name"
becomes
-CreateVideoTracker VT1 # "vt name"
The VT1 word can actually be anything, so I'm using the regex
$line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g;
which gives me the result:
-CreateVideoTra...
Hi Guys I'm very new to regex, can you help me with this.
I have a string like this "<input attribute='value' >" where attribute='value' could be anything and I want to get do a preg_replace to get just <input />
How do I specify a wildcard to replace any number of any characters in a srting?
like this? preg_replace("/<input.*>/",$r...
I'm trying to substitute something in a string in python and am having some trouble. Here's what I'd like to do.
For a given comment in my posting:
"here are some great sites that i will do cool things with! http://stackoverflow.com/it's a pig & http://google.com"
I'd like to use python to make the strings like this:
"here are some ...
Given an HTML link like
<a href="urltxt" class="someclass" close="true">texttxt</a>
how can I isolate the url and the text?
Updates
I'm using Beautiful Soup, and am unable to figure out how to do that.
I did
soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url))
links = soup.findAll('a')
for link in links:
print "link co...
Before anybody asks, I am not doing any kind of screenscraping.
I'm trying to parse an html string to find a div with a certain id. I cannot for the life of me get this to work. The following expression worked in one instance, but not in another. I'm not sure if it has to do with extra elements in the html or not.
<div\s*?id=(\""|&q...
I need to cut out and save/use part of a string in C#. I figure the best way to do this is by using Regex. My string looks like this:
"changed from 1 to 10".
I need a way to cut out the two numbers and use them elsewhere. What's a good way to do this?
...
How can I get the value between quotes with an RegEx
for example I want to find all the parameters from the function test
<html>
test("bla");
print("foo");
test("moo");
</html>
The result must be { "bla", "moo" }
...