This is the Htacces rule:
RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/?$ ir.php?id=$1
how should I pass it to a Nginx compliant rewrite rule... i read the doc and did this:
rewrite ^([A-Za-z0-9-]+)/?$ ir.php?id=$1 last;
But didnt work.
and another question:
Is there any equivalent of .htaccess to Nginx (per directory rules)
Thank...
I have a 4MB log file from the Windows XP firewall which I'm trying to find lines that have both DROP and an IP and a port number. My regex-fu is weak and I'm assuming this is the reason I'm struggling.
The words "DROP", "10.1.1.1" (for example) and "8801" need to be found on the same line and may be spread across the line and separated...
I am working on a Regex pattern for searches that should allow optional '+' sign to include in the search and '-' sign to exclude from the search. For example: +apple orange -peach should search for apples and oranges and not for peaches. Also the pattern should allow for phrases in double quotes mixed with single words, for example: "re...
Hi.
I use the following function to rename thumbnails.
For example, if I upload a file called "image.png" to an upload folder, and this folder already has a file named "image.png" in it, the new file automatically gets renamed to "image-copy-1.png". If there also is a file called "image-copy-1.png" it gets renamed to "image-copy-2.png" a...
I'm new to using regexp, can someone give me the regexp that will strip out everything but an integer from a string in javascript?
I would like to take the string "http://www.foo.com/something/1234/somethingelse" and get it down to 1234 as an integer.
Thanks
...
Hello
I'm trying to develop a function that can sort through a string that looks like this:
Donny went to the {park|store|{beach with friends|beach alone}} so he could get a breath of fresh air.
What I intend to do is search the text recursively for {} patterns where there is no { or } inside the {}, so only the innermost sandwiche...
i have multiple strings containing a link like:
<A HREF="http://www.testings2">testings2</A>
<A HREF="http://www.blabla">blabla</A>
<A HREF="http://www.gowick">gowick</A>
i want to use a regex pattern that gets the uri within the href.
i could do like:
/".*?"/
but then the "" will come along. is ther...
Sorry if this has been asked, my search brought up many off topic posts.
I'm trying to convert wildcards from a user defined search string (wildcard is "*") to postgresql like wildcard "%".
I'd like to handle escaping so that "%" => "\%" and "\*" => "*"
I know i could replace \* with something else prior to replacing * and then swap i...
How would you use regex to write functions to do the following:
Replace lowercase 'a' with uppercase and vice versa
If easily extensible, do this for all letters
Where words are separated by whitespaces and > and < are special markers on some words, replace >word with word< and vice versa.
If it helps, you can restrict input such th...
I need to add markup to some text using JavaScript regular expressions. In Python I could do this with:
>>> import re
>>> re.sub('(banana|apple)', r'<b>\1</b>', 'I have 1 banana and 2 apples!')
'I have 1 <b>banana</b> and 2 <b>apple</b>s!'
What is the equivalent in JavaScript?
string.replace(regex, newstring) seems to only take a raw ...
I have text file, like
FILED AS OF DATE: 20090209
DATE AS OF CHANGE: 20090209
I need to find the position using FILED AS OF DATE: and read the date. I know how to do it using python strings. But using a regular expression seems cooler:)
Btw, how to parse the date?
Thanks!
...
Given a string like String a="- = - - What is your name?";
How to remove the leading equal, dash, space characters, to get the clean text,
"What is your name?"
...
You can backreference like this in JavaScript:
var str = "123 $test 123";
str = str.replace(/(\$)([a-z]+)/gi, "$2");
This would (quite silly) replace "$test" with "test". But imagine I'd like to pass the resulting string of $2 into a function, which returns another value. I tried doing this, but instead of getting the string "test", I...
I have the following string:
<div id="mydiv">This is a "div" with quotation marks</div>
I want to use regular expressions to return the following:
<div id='mydiv'>This is a "div" with quotation marks</div>
Notice how the id attribute in the div is now surrounded by apostrophes?
How can I do this with a regular expression?
Edit: ...
I'm trying to match a SEDOL (exactly 7 chars: 6 alpha-numeric chars followed by 1 numeric char)
My regex
([A-Z0-9]{6})[0-9]{1}
matches correctly but strings greater than 7 chars that begin with a valid match also match (if you see what I mean :)). For example:
B3KMJP4
matches correctly but so does:
B3KMJP4x
which shouldn...
Regular expressions have always been my pet peeves. Every time I think that I finally got it I have a new problem !
I want to catch url like this :
http://www.mydomain.com/boutique/blabla-1/bla-bla2/99/104
http://www.mydomain.com/boutique/blabla1/99
and eventually :
http://www.mydomain.com/boutique/blabla-1/bla-bla2/product1/99/104/...
I am wondering why the following regex does not match.
string query = "\"1 2\" 3";
string pattern = string.Format(@"\b{0}\b", Regex.Escape("\"1 2\""));
string repl = Regex.Replace(query, pattern, "", RegexOptions.CultureInvariant);
Note that if I remove the word boundary characters (\b) from pattern, it matches fine. Is there somethi...
var exampleURL = '/example/url/345234/test/';
var numbersOnly = [?]
The /url/ and /test portions of the path will always be the same.
Note that I need the numbers between /url/ and /test. In the example URL above, the placeholder word example might be numbers too from time to time but in that case it shouldn't be matched. Only the num...
I'm trying to make a dynamic regex that matches a person's name. It works without problems on most names, until I ran into accented characters at the end of the name.
Example: Some Fancy Namé
The regex I've used so far is:
/\b(Fancy Namé|Namé)\b/i
Used like this:
"Goal: Some Fancy Namé. Awesome.".replace(/\b(Fancy Namé|Namé)\b/i, '...
What would the regex expression that would go into preg_split function to validate date in the format of
7-Mar-10 or how can I validate a date of format 7-Mar-10 in PHP
Thanks.
...