I found out that you cannot use a RewriteCond backreference as a pattern condition in the next Rewrite Cond...
What I have looks right, but Tim is correct in the comment bellow... This is still passing when we are beyond the expiration date saved in the cookie.
Any ideas on how to actually test the value instead of the existence?
Rewr...
Hi I was composing a regex for a password field of my site and had a concern:
Are there any characters I should block a user from entering? If so why?
Or is it enough just to escape dangerous characters like = and ' when processing data?
It seems good for this topic to list the php functions for escaping those, if you would.
Thanks!
...
Hi *,
I’m learning regular expressions and I’m playing a little with them. I proposed myself an exercise in which I have a method that removes the columns aliases in a SQL Select statement. This should work like this:
The method can remove aliases in a SQL
select statement with the AS keyword:
“select ColumnA AS A”
The method can remo...
Hey all,
I'm trying to use named groups to parse a string.
An example input is:
exitcode: 0; session id is RDP-Tcp#2
and my attempted regex is:
("(exitCode)+(\s)*:(\s)*(?<exitCode>[^;]+)(\s)*;(\s)*(session id is)(\s)*(?<sessionID>[^;]*)(\s)*");
Where is my syntax wrong?
Thanks
...
Given a string of pipe-separated values (call it $psv), I want to be able to split by those pipes and populate an array. However, the string can also contain escaped pipes (\|) and escaped escapes (\\), both of which are to be considered mere literals. I have a couple solutions for this problem in mind:
Replace both escape sequences wi...
Suppose input = "Hello" and pattern is "World"
I want to determinine that thr pattern does not occur in input.
Since pattern does not occur in input Regex.IsMatch should return true.
How can I write the pattern in C#
...
I am to import a file, say june.txt that would have data such as the following data:
Sandy,820,384,133,18,408
Wanda,120,437,128,807,595
Jane,631,415,142,687,600
Andrea,179,339,349,594,986
Wanda,803,191,6,807,322
Jane,741,975,34,15,832
Jane,239,714,250,94,497
Andrea,219,188,411,584,713
And t...
hi - why is this expression returning true for character 1 or V (and others)?
how could i rewrite it so that it would return true only when its blank or a character a-z?
~((^$)||(^[a-z]$))~
...
I need a simple markup language to store different parts of a string on a TEXT field, and then extract those parts.
So basically I want some kind of simple XML. Storing those in the table field is easy, but extracting them... is other matter.
I managed to do so using a simple regex done for regular HTML:
|<[^>]+>(.*)</[^>]+>|U
But in ...
Hi,
I am trying to remove following tag from string.
[caption id="attachment_9" align="alignleft" width="137" caption="test"][/caption]
How do I remove it using php's preg_replace?
I tried serveral regular expression, but failed all.
Please advise me.
Thanks.
...
What is the regular expression to find the first newline (\n) in a text (used to find and delete the newline)? I'm using the regular expression in ActionScript and tried
ta.text = ta.text.replace(/\n*/,'')
but it doesn't seem to work
Thanks
...
How to remove all non alphanumeric characters from a string except dash and space characters.
...
Consider the snippet:
var_dump(preg_split("/./", "A.B.C")); // split on anything as the dot has not been escaped
which produces the output:
array(6) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(0) ""
[5]=>
string(0) ""
}
Can anyone please explain how it works? Al...
Let's say I want to match one of the following characters: a, b, c, or + (in JavaScript). Do I need to escape the +? Is it /[abc+]/ or /[abc\+]/? Both work in my limited selection of test browsers. Which is (more) correct?
...
what is wrong with this?
for i in 'ls | grep '^[A-Z]......$'
do
echo $i
done
if i just use the command ls | grep '^[A-Z]......$ i get the files i want
What am i missing?
M
...
How can I transform the string "a b a c d a a" into the string "1 b 2 c d 3 4" with a regular expression?
Is this possible? Preferred flavor is perl, but any other will do too.
s/a/ \????? /g
...
Hello Experts,
Given the following URIs sample:
/index.site.rooms.98.html
/index.site.rates.665678.html
I need to capture the string which identifies the page with REGEX:
Rooms
Rates
Thanks
...
I have a html source as a String variable.
And a word as another variable that will be highlighted in that html source.
I need a Regular Expression which does not highlights tags, but obly text within the tags.
For example I have a html source like
<cfset html = "<span>Text goes here, forr example it container also **span** </span>" ...
I've a regular expression that should validate if a string is composed by space-delimited strings. The regular expression works well (ok it allows a empty space in the end ... but that's not he problem) but takes too long when the validation fails.
The regular expression is the following:
/^(([\w\-]+)( )?){0,}$/
When trying to valida...
Hi all,
I am looking for means to highlight certain text on a page. I use <span class="highlight">This is a sample</span> to replace the text "This is a sample" that is found, with the help of the preg_replace function.
My problem arises when there is overlapping text. If I search for the phrase "sample text" on the same page, it is no...