I'm trying to get some stuff from a string in php. In RegexBuddy and Regular expression tester (firefox addon) it works good, but php gives me the following:
Warning: preg_match()
[function.preg-match]: Compilation
failed: unmatched parentheses at
offset 34 in
D:\path\example.php
on line 62
my pattern is "/.{4}_tmp\\([A-Z...
I need a regex pattern to match this format ABC12345678:
it should start with ABC and should have preceding 8 numbers.
...
I am trying to convert a conversation I downloaded from Wikipedia into XML. I used the special export to get the page in XML format... that works great until I get to the main conversation.
<conversation>
{{PersonA|Cheese}}
{{PersonB|I like it too...}}
{{PersonA|Cheese?}}
</conversation>
Thats not the real conversation... ...
I am trying to build a regular expression in javascript that checks for 3 word characters however 2 of them are are optional. So I have:
/^\w\w\w/i
what I am stumped on is how to make it that the user does not have to enter the last two letters but if they do they have to be letters
...
I have Perl code:
my $s = "The+quick+brown+fox+jumps+over+the+lazy+dog+that+is+my+dog";
I want to replace every + with space and dog with cat.
I have this regular expression:
$s =~ s/\+(.*)dog/ ${1}cat/g;
But, it only matches the first occurrence of + and last dog.
...
How can I find as many date patterns as possible from a text file by python? The date pattern is defined as:
dd mmm yyyy
^ ^
| |
+---+--- spaces
where:
dd is a two digit number
mmm is three-character English month name (e.g. Jan, Mar, Dec)
yyyy is four digit year
there are two spaces as separators
Thanks!
...
heya,
We have an Excel file with a worksheet containing people records.
1. Phone Number Sanitation
One of the fields is a phone number field, which contains phone numbers in the format e.g.:
+XX(Y)ZZZZ-ZZZZ
(where X, Y and Z are integers).
There are also some records which have less digits, e.g.:
+XX(Y)ZZZ-ZZZZ
And others with ...
I'm using the Markdown library for PHP by Michel Fortin. I started noticing that it formats the text in tags with markdown rules, like so:
http://foo.com/My_Url_With_Underscores
essentially becomes:
<a href="...">http://foo.com/My<em>Url</em>With_Underscores</a>
How do I disable that behavior or otherwise prevent...
I would like to conditionally remove a block of text between specifed start and stop delimiters. The code below does not work, but hopefully it suggests enough of what I am trying to accomplish.
If dr("ReferralPoints") > 0 Then
Dim objRegex As Regex = New Regex("[HASNOVALUE:REFERRALPOINTS](.*)[/HASNOVALUE:REF...
This is Part 2 of this question and thanks very much for David's answer. What if I need to extract dates which are bounded by two keywords?
Example:
text = "One 09 Jun 2011 Two 10 Dec 2012 Three 15 Jan 2015 End"
Case 1 bounding keyboards: "One" and "Three"
Result expected: ['09 Jun 2011', '10 Dec 2012']
Case 2 bounding keyboards: "Tw...
Problem: Turn "my testtext TARGETSTRING my testtext" into "my testtext targetstring my testtext"
Perl supports the "\L"-operation which can be used in the replacement-string.
The Pattern-Class does not support this operation:
Perl constructs not supported by this class:
[...]
The preprocessing operations \l \u, \L, and \U.
...
I've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post.
His regular expression works, but needs extra code after detection is done.
I've managed to write a regular expression that does everything in ...
Hello,
Im trying to find a regular expression that matches this kind of URL:
http://sub.domain.com/selector/F/13/K/100546/sampletext/654654/K/sampletext_sampletext.html
and dont match this:
http://sub.domain.com/selector/F/13/K/10546/sampletext/5987/K/sample/K/101/sample_text.html
only if the number of /K/ is minimum 1 and maximum ...
I'm having some trouble translating my working C# regular expression into JavaScript's regular expression implementation.
Here's the regular expression:
([a-z]+)((\d+)([a-z]+))?,?
When used on "water2cups,flour4cups,salt2teaspoon" you should get:
[
["water", "2cups", "2", "cups"]
["flout", "4cups", "4", "cups"]
["salt", ...
Ive been working some time on own template engines but i alwais get stuck in strucktured documents like
<block : block1>
<table>
<block : row>
<tr>
<td>
{value}
</td>
<td>
{value2}
</td>
</tr>
...
Hi
I am new to Regex, however I decided it was the easiest route to what I needed to do. Basically I have a string (in PHP) which contains a whole load of HTML code... I want to remove any tags which have style=display:none...
so for example
<img src="" style="display:none" />
<img src="" style="width:11px;display: none" >
etc...
...
I'm trying to write a a regex to validate a string to match the following rules.
Must start with a-z (case insensitive)
Must only contain a-z A-Z 0-9 . -
I've put something together based on my limited knowledge and ran it through an online testing tool for a whole bunch of situations and the results were as I had hoped however when ...
If I have the string hello world , how can I modify the regex world|wo|w so that it will match all of "world", "wo" and "w" rather than just the single first match of "world" that it comes to ?
If this is not possible directly, is there a good workaround ? I'm using C# if it makes a difference:
Regex testRegex = new Regex("world|wo|w")...
For example I have this string of 2 json objects:
{"glossary": {"title": "example glossary"}, "aaa": "1212"}{"adada": "faka"}
I want to split it in the array for PHP and Actionscript 3
Array (
[0] => '{"glossary": {"title": "example glossary"}',
[1] => '{"adada": "faka"}'
)
What is the best method to do it.
Edit:
I don't ne...
Hi all.
I have a simple problem: I want to construct a regex that matches a form in HTML, but only if the form has any input tags. Example:
The following should be matched (ignoring attributes):
..
<form>
..
<input/>
..
</form>
..
But the following should not (ignoring attributes):
..
<form>
..
</form>
..
I have tried everything f...