You wrote this code:
accentsTidy = function(s){
var r=s.toLowerCase();
r = r.replace(new RegExp("\\s", 'g'),"");
r = r.replace(new RegExp("[àáâãäå]", 'g'),"a");
r = r.replace(new RegExp("æ", 'g'),"ae");
r = r.replace(new RegExp("ç", ...
I want cut out everything inside (tags included) from text, for ex:
[url=http://xxx.com]something[/url]
but with one condition, inside of [url] tag there would be [img] tag.
So final sentence to cut:
[url=http://xxx.com]anything[img]something[/url]
can anyone help? im bad with regular expressions, or there is easier way?
...
I'm trying to create a regex that matches a URL that has a capital letter before the query string. I want to capture the query string including the question mark and I want to capture the non-query string part. If there is no query string, but there is a capital letter, then the non query string part should be captured.
A few examples:...
I would like a simple way to find and reformat text of the format 'DD/MM/YYYY' into 'YYYY/MM/DD' to be compatible with MySQL TIMESTAMPs, in a list of text items that may or may not contain a date atall, under python. (I'm thinking RegEx?)
Basically i am looking for a way to inspect a list of items and correct any timestamp formats found...
How do i do a regular expression that will allow everything except !@$%^&*()_+={}[]|\:";'<>,.?/ (If i need to detect more than these can I simply add them into the regexp later?)
I intend using this to check if these character are present in postal addresses a user submits. So if they were there, I could reject the address.
Thanks
...
I have the following possible strings that I need to turn into arrays so I can feed them into an html generator. I am not staring with html or XML, I am trying to create a shorthand that will allow me to populate my html objects much simpler and faster with more readable code.
id='moo'
id = "foo" type= doo value ='do\"o'
on_click='...
I have a primary domain - let's call it xyz.com. I also have several other secondary domains such as abc.com def.com, ghi.com, etc.. These domain all have the same content.
I am trying to do a URL redirect in IIRF that will take any of the secondary domains, and replace it with my primary xyz domain.
This is the closest I have gotten.
...
Hi There - I am hoping that someone can help me. I am not exactly sure how to use the following regex. I am using classic ASP with Javascript
completehtml = completehtml.replace(/\<\!-- start-code-remove --\>.*?\<\!-- start-code-end --\>/ig, '');
I have this code to remove everything between
<\!-- start-code-remove --\> and <\!--...
I have a conditional regular expression that works on regex test websites, such as regexlib.com, but cannot get it to work in my Java application.
But, http://www.regular-expressions.info/conditional.html indicates that Java doesn't support conditionals, but I've seen other posts on SO imply that it does.
An example of my RegEx is:...
Consider a list of numbers:
1
2
3
17
8
9
23
...etc.
I want to replace these numbers with another number, based on another list:
1001=1
1002=2
1003=3
1004=8
1005=23
1006=9
1007=17
What is the quickest way to do this? (like using regular expression in Notepad++, etc.)
...
The Java EE REST specifaction, JAX-RS, describes the translation of path variables to regexes, like in /customer/{id}.
From JAX-RS 1.1 Spec, page 19:
Replace each URI template variable with a capturing group containing the specified regular expression or ‘([ˆ/]+?)’ if no regular expression is specified.
The Java API doc of java.ut...
i've got a jruby regex that i'm printing in rails:
@@private = /somethingthatshouldnevermatch/
def secure?
puts "security test(#{action_name}/#{@@private}: #{@@private.match(action_name).nil?.to_s}"
action_name =~ @@private
end
on os x, using WEBRick and jruby, this prints
security test(index/(?-mix:somethingthatshouldnevermatch...
I have a variable $word and I'd like to match it in my select statement
somethig like this: "select * from table where column regex '[0-9]$word'"
but this doesnt work, so how can i put a variable in a regular exprssion?
Thank you
...
How can I match a word in a sentence from a column using regex? I tried:
"select * from table where column regex '/\b".$text."\b/i'"
but that didn't work. Thanks in advance.
...
I have a string h2#test- ruby is so awesome, blah, blah, blah. I want to have #test to be the only characters left. is there a way in ruby to run a Regular Expression that removes all other characters?
...
Is it possible to make a regex match only the first line of a text? So if I have the text:
This is the first line.
This is the second line.
...
It would match "This is the first line.", whatever the first line is.
...
I'm using this:
jQuery.validator.addMethod("regex2", function(value, element, param) {
return value.match(new RegExp("." + param + "$"));
});
$("#phonenumber").rules("add", { regex2: "[0-9]+"})
to validate a phone. The phone number must be at least 7 digits long, the I got this regex from elsewhere and am using the parameter minle...
I want to see if a text already is in a file using regexp.
# file.txt
Hi my name is Foo
and I live in Bar
and I have three children.
I want to see if the text:
Hi my name is Foo
and I live in Bar
is in this file.
How can I match it with a regexp?
...
I'm working on a project right now that is a shoutbox. Since I have disabled all HTML as people would most likely forget to close a tag ans screw up everything, I wanted to make a different form of adding some flair for people to use in their posts.
What I want to to is setup a regular expression in PHP to add tags around text. Here i...
Would this be the correct regexp to allow A-Z a-z 0-9 and symbols #&()-\;,.'" and spaces?
I'm struggling with the ' and " inside the regexp. Is what I've done correct? Note the \' and \". It just doesn't seem right. Whats the right way to do it?
if (preg_match('/^[a-z0-9#&()-\;,.\'\" ]+$/i', $username) )
{
echo "Good";
} ...