if i have a <form action='./search' method='get'> with <input type='text' name='keyword' value='this is the search term' />inside
after submitting the form, it leads me to /search?keyword=this%20is%20the%search%20term
what regex should i use to capture that form of url and rewrite it to /search-this_is_the_search_term
...
I"m building a registration form, and I need to validate the user's inputs. (username, email, password).
I have regular expressions set up for each of these, and I can easily validate each in PHP using preg_match, and if it returns false, I can display an error.
However, I think it'd be much nicer if the page did not have to refresh to...
I have to replace "something" in file with :something.
My editor is kate can anyone suggest a search expression and placeholder for that.
Example
Input
"code"
"name"
"remark"
Output
:code
:name
:remark
...
For now I'm using this regexp:
^\A([a-z0-9\.\-_\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z$
I think it is not very good. So what's the best regular expression you have or have seen for validating jids?
For reference, Section 3 of the XMPP core standard defines a JID in Augmented Backus-Naur Form as
jid = [ node "@" ] domain [ "...
If a few of you are unfamiliar with Wordpress's YouTub tag, it looks like this
[youtube=http://www.youtube.com/watch?v=ooCLnrmIRFo&feature=related]
I am not very good with regular expressions, and all I have found out how to do is get from everything in between "[youtube=" and "]" using the following, but i need the value of "v".
...
Hi all,
I'm still a noob with reqular expression, so I need a little help. I need to capture
either
\d+\.\d+
or
\d+
but nothing else. For instance, "0.02", "1" and "0.50" should match positively. After few tests, I noticed that I cannot simply put something like
[\d+\.\d+|\d+]
It'll be highly appreciated, if somebody could show me...
Hi guys,
I need some help extracting the following bits of information using regular expressions.
Here is my input string "C:\Yes"
**** Missing character at start of string and in between but not at the end =
a weird superscript looking L.***
I need to extract "C:\" into one string and "Yes" into another.
Thanks In Advance.
...
Hi all!
I'm makin' a scripting language interpreter using PHP. I have this code in that scripting language:
write {Hello, World!} in either the color {blue} or {red} or {#00AA00} and in either the font {Arial Black} or {Monaco} where both the color and the font are determined randomly
(Yes, it's hard to believe but that's the syntax)...
Desperate, please help. Will work for food :)
I want to be able to have pages at the following URLs, and I want to be able to look them up by their URL (ie, If somebody goes to a certain URL, I want to be able to check for a page there).
mysite.com/somepage/somesubpage/somesubsubpage/
mysite.com/somepage/somesubpage/anothersubpage/
my...
I'm trying to find eveything inside a div using regexp. I'm aware that there probably is a smarter way to do this - but I've chosen regexp.
so currently my regexp pattern looks like this:
$gallery_pattern = '/([\s\S]*)<\/div>/';
And it does the trick - somewhat.
the problem is if i have two divs after each other - like this.
<div c...
In other words, I have a string like:
"anything, escaped double-quotes: \", yep" anything here NOT to be matched.
How do I match everything inside the quotes?
I'm thinking
^"((?<!\\)[^"]+)"
But my head spins, should that be a positive or a negative lookbehind? Or does it work at all?
How do I match any characters except a double-qu...
I've come across a bug in my site: basically, it won't allow page names with full stops (periods) in them. I know the root of the problem is in my .htaccess file.
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ index.php?section=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?section=$1&page=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\...
Hello, I am trying to write a regular expression to match and split a custom variable syntax in C#. The idea here is a custom formatting of string values very similar to the .NET String.Format/{0} style of string formatting.
For example the user would define a String format to be evaluated at runtime like so:
D:\Path\{LanguageId}\{Pers...
/^"((?:[^"]|\\.)*)"/
Against this string:
"quote\_with\\escaped\"characters" more
It only matches until the \", although I've clearly defined \ as an escape character (and it matches \_ and \\ fine...).
...
Can someone please explain how you can write a url pattern and view that allows optional parameters? I've done this successfully, but I always break the url template tag.
Here's what I have currently:
Pattern
(r'^so/(?P<required>\d+)/?(?P<optional>(.*))/?$', 'myapp.so')
View
def so(request, required, optional):
If I use the url t...
I'd like to use AliasMatch to create an alias for everything within a folder, except for two (or more) specific regex patterns.
For instance the following AliasMatch creates an alias for everything in the 'content' folder:
AliasMatch /content(.*) /home/username/public_html/$1
But there are two regex patterns that I don't want the abo...
What is a good way for handling parameters in localized strings in javascript?
I am using the same format as in java's MessageFormat class, e.g.:
There are {0} apples in basket ID {1}.
Where {0} will be replaced with the first parameter and {1} with the second.
This is the call I want to use in JS (i.e. I want to implement origStr):
...
Hey
I'm using a regular expression to check the format of a supplied date in my ASP.NET MVC exception. However, every time I run it the action the web server crashes and Visual Studio reports and unhandled System.StackOverflowException
//If the supplied date does not match the format yyyy-mm-dd
//Regex taken from www.regexlib.com
if(!...
I want to extract Urdu phrases out of a user-submitted string in PHP. For this, I tried the following test code:
$pattern = "#([\x{0600}-\x{06FF}]+\s*)+#u";
if (preg_match_all($pattern, $string, $matches, PREG_SET_ORDER)) {
print_r($matches);
} else {
echo 'No matches.';
}
Now if, for example, $string contains
In his books (s...
I'm trying to understand how (?<name>pattern) works in Regex. Is there a good link or can someone offer a simple explanation?
...