Hi,
I'm trying to extract a number from a string.
And do something like this [0-9]+ on this string "aaaa12xxxx" and get "12".
I thought it would be something like:
> grep("[0-9]+","aaa12xxx", value=TRUE)
[1] "aaa12xxx"
And then I figured...
> sub("[0-9]+", "\\1", "aaa12xxxx")
[1] "aaa12xxx"
But I got some form of response doin...
Hi
I'm using the dojo filtering select widget. I'm trying to customize the queryExpr. According to all forums/documentation, there are 4 types of expressions:
- ${0} - find exact expression
- ${0} - contains
- ${0}* - starts with
- *${0} - ends with
I'm trying to accomplish an auto-completion where any word starts with the typed in...
I am having issues with a couple arrays below and the match method. On my page I call the Checkout() function and it sets a temporary array equal to the array I've been building with different options. It then loops through the temporary array and removes html from one of the elements. The issue is that when I alert the array Remote.C...
I want to capitalise each word and combine it into 1 word, e.g:
home = Home
about-us = AboutUs
Here is the function I use at the moment, can regex do this better or more efficient?
public function formatClassName($name)
{
$name = str_replace('-', ' ', $name);
$name = ucwords($name);
$name = str_replace(' ', '', $name);
retur...
I'm trying to remove from a string everything start with / char, so if I have
my_value/j/im<b*+èo[/h>e\ylo
I'd like to remove the string /j/im<b*+èo[/h>e\ylo and return only my_value.
I thought to use something with str_replace but I'm not a great regex programmer and I'm doing practise with php.
function clean_value ($value) {
r...
I need to include an optional trailing forwardslash, that's an /, in my RewriteRule
What I have so far is
RewriteRule ^([a-zA-Z0-9]+)$ u.php?$1|$2
Which works fine, for example http://foo.bar/abcde will redirect to http://foo.bar/u.php?abcde and handles any querystring parameters that may be present.
What I need to do is take http:/...
Suppose I have a string "a foobar" and I use "^a\s*" to match "a ".
Is there a way to easily get "foobar" returned? (What was NOT matched)
I want to use a regex to look for a command word and also use the regex to remove the command word from the string.
I know how to do this using something like:
mystring[:regexobj.start()] + email...
I'm getting strings with values such as /Date(1)/ and /Date(-99999)/. The digits are variable length.
Wouldn't the regex just be this: ^/Date\(d+\)/$
...
I have a problem trying to transform a given input string to a given output string using regular expressions in Javascript. I'm not even sure if what I'm trying to accomplish can be done with regular expressions, or would be most efficient using some other means. I'm hoping someone can help:
I have the following input string:
#> Some...
Hi, I'm trying to do so if the user going to this url:
http://www.abc.com/
it will redirect him to
http://www.abc.com/minisite/
or, if he's going to tihs url:
http://www.abc.com/dir/something.php
it will redirect him to:
http://www.abc.com/minisite/dir/something.php
I'm trying to do this in Mod_Rewrite... Here is what I've wrrite...
Im trying to do this sort of rewrite that only affects some urls to make them go to anchors.
So if I see this request:
/somedir/trigger/something
I want to transform it to this request. I can guarantee there will be no slash after the trigger. The "something" part is going to be a alpha-numeric string every time. The "trigger" part i...
I have a bunch of elements with names similar to "comp[1].Field" or "comp[3].AnotherField" where the index (1 or 3) changes. I'm trying to extract the index from the name.
Right now I'm using:
var index = $(":input:last").attr("name").match(/\[(\d+)\]/)[1];
but I don't feel like this is the best way to do this.
Any suggestions?
...
Hey guys!
My first question here at so!
To the point;
I'm pretty newbish when it comes to regular expressions.
To learn it a bit better and create something I can actually use, I'm trying to create a regexp that will find all the CSS tags in a CSS file.
So far, I'm using:
[#.]([a-zA-Z0-9_\-])*
Which is working pretty fine and finds...
how can I format below string
Address1=+1234+block+of+XYZ+Street+Address2=+Santa+Fe+Springs+State=+California
to string
Address1=+1234+block+of+XYZ+Street+&Address2=+Santa+Fe+Springs+&State=+California
The below regex doesnt work properly.could someone fix this?
string inputString = "Address1=+1234+block+of+XYZ+Street+Address2=+Sant...
Hi, i want to delete all characters except a-zA-Z0-9 and _ chracter. How can do that in php ?
...
I'm setting up nginx and I need to use the location directive to match all requests that begin with /site1 AND end with .php. What regex do I use to do this?
I know I can use ^ to match the beginning of the string and $ to match the end of string. So I'm able to match the beginning of the string OR the end of the string as ^(/site)|(\.p...
Hi! I was trying to split an arithmetic expression (eg "1+2+10+15") on the plus signs. However, I didn't manage to write the appropriate regular expression. I thought this would work:
expression.split("\\+");
but it doesn't. Do you know the correct solution?
...
Im looking for a ruby regex to match this
@variables{
color1 | #FFFFFF | links;
color2 | #c1dfee | frame;
}
however - what is inside the braces is not important. I just want to capture that @variables{} with its content. So I guess Im looking for something like /@variables{MATCH-ANYTHING}/m
Thanks.
...
I've spot very odd behavior of mysql.
The select below returns 0:
SELECT CONVERT('a' USING BINARY) REGEXP '[\x61]'
However semantically identical select below returns 1:
SELECT CONVERT('a' USING BINARY) REGEXP '[\x61-\x61]'
Do you know what is happening here?
I've tested that in mysql 5.0.0.3031 and 4.1.22
I need the hex character...
I found some interesting possibility in many regex engines:
It's possible to place backreference inside the capture group and reference this group.
For example: (\1)
My question: for what regex patterns it may be used? I can't imagine...
...