I'm using jQuery to add icons to specific links, e.g. a myspace icon for sites starting with http://myspace.com etc.
However, I can't figure out how to use regular expressions (if that's even possible here), to make jQuery recognize the link either with or without "www." (I'm very bad at regular expressions in general).
Here are two e...
I am currently writing an application in JavaScript where I'm matching input to regular expressions, but I also need to find a way how to match strings to parts of the regular expressions.
For example:
var invalid = "x",
potentially = "g",
valid = "ggg",
gReg = /^ggg$/;
gReg.test(invalid); //returns false (correct)
gReg.t...
Hi all,
I'm trying to parse a DSN (from a Symfony application) using regular expressions, in order to link with a secondary application, but using the same database.
The DSN I currently have is:
mysql:dbname=my_db_name;host=localhost
with a regex of:
/^(\w+):(dbname=(\w+))?;?(host=(\w+))?/
(using preg_match()). This matches OK, ...
Hi all
i want to create a regular expression which will allow only spaces and number..
And how can i check this with PHP?
Thanks in advance
Avinash
...
I have been working with an existing website out company has running until I finish developing the new site.
I've been asked to add some additional functionality to booking pages that will automatically set a booking button based on passed parameters.
The existing working regex is as follows:
RewriteRule ^.+-(\d+)\.accommodation$ prop...
Is it possible to determine whether the implementation of ruby you're running on is capable of supporting fork, without running a regex against RUBY_PLATFORM that'll expand until it summons Cthulhu?
(Related question: Ruby - How can I find out on which system my program is running?)
Edit: I tried Marc-Andre's suggestion. It doesn't wor...
First and foremost, I do not know RegEx but am trying to piece something together to make this work. Just wanted you to be forewarned. ;)
Anyways, I'm trying to create a regular expression to take a word from an array and see if it matches a word in another array. I only want the search to return true if the keyword array string contain...
I am porting some functionality from a C++ application to java. This involves reading non-modifiable data files that contain regular expressions.
A lot of the data files contain regular expressions that look similar to the following:
(?<=id="VIEWSTATE".*?value=").*?(?=")
These regular expressions produce the following error:
"Look-...
How would I match a space separated list of words followed by whitespace and some optional numbers?
I have this:
>>> import re
>>> m = re.match('(?P<words>(\S+\s+)+)(?P<num>\d+)?\r\n', 'Foo Bar 12345\r\n')
>>> m.groupdict()
{'num': '12345', 'words': 'Foo Bar '}
I'd like the words group to not include the last whitespace(s) but I can...
I'm trying to use regular expression to extract the comments in the heading of a file.
For example, the source code may look like:
//This is an example file.
//Please help me.
#include "test.h"
int main() //main function
{
...
}
What I want to extract from the code are the first two lines, i.e.
//This is an example file.
//Please...
Hi,
I'm trying to convert a camtasia html/javascript video embed code to a wordpress flowplayer shortcode.
The original code is as follows:
<p>The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Adobe Flash Player. If you are you using a browser with JavaScript disabled plea...
I've got (To) [a-z]+ as regular expression and I've got sentence: To kot dziki pies.
And If I compile it I will retrieve To kot.
So what can I do to retrieve only word after (only kot) "To" instead of "To kot"?
...
i have a string like following:
Assigned to ram on 2010-04-22 12:30:13.0
i need to extract the third word (ram). I tried the below regex, its not working.
/\s[a-zA-Z]*\s/
any help to fix this would be greatly appreciated.
...
given text:1,0397,030 followed by nothing or any number of characters not in the set [,0-9] why is my regex not being greedy enough? Javascript's regex is supposed to be greedy by default, right?
but text.match('[,0-9]+'); pulls back 1,0397 instead of 1,0397,030
var matches = shortInput.match('[0-9]+[,0-9]*[0-9]*');
works. This is in...
I have some code validating a string of 1 to 32 characters, which may contain only alpha-numerics and hyphens ('-') but may not begin or end with a hyphen.
I'm using PCRE regular expressions & PHP (albeit the PHP part is not really important in this case).
Right now the pseudo-code looks like this:
if (match("/^[\p{L}0-9][\p{L}0-9-]{...
I need to find all strings without a given string before it.
For Instance:
Find: "someValue"
**All results with "function(" before them should be ignored
The Visual Studio regular expression would find this:
value = someValue
And Ignore something looking like this:
function(someValue)
What is the best way to go about this?
Th...
Hi all,
I've got the following regular expression that works fine on my testing server, but just returns an empty string on my hosted server.
$text = preg_replace('~[^\\pL\d]+~u', $use, $text);
Now I'm pretty sure this comes down to the hosting server version of PCRE not being compiled with Unicode property support enabled. The diffe...
My input file is as below :
HEADER
{ABC|*|DEF {GHI 0 1 0} {{Points {}}}}
{ABC|*|DEF {GHI 0 2 0} {{Points {}}}}
{ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}}
{ABC|*|XYZ:ghi:jkl {JKL 0 372 0} {{Points {}}}}
{ABC|*|XYZ:mno:pqr {GHI 0 34 0} {{Points {}}}}
{
ABC|*|XYZ:abc:pqr {GHI 0 68 0}
...
I'm using Clojure, so this is in the context of Java regexes.
Here is an example string:
{:a "ab,cd, efg", :b "ab,def, egf,", :c "Conjecture"}
The important bits are the commas after each string. I'd like to be able to replace them with newline characters with Java's replaceAll method. A regex that will match any comma that is not su...
Can regular expressions be used to perform arithmetic? Such as find all numbers in a file and multiply them by a scalar value.
...