Hey, long story short I have inherited some terrible code. As a result a string comparison is buggy when comparing dates due to the format of the date. I am trying to convert the date to a valid DateFormat syntax so I can run a proper comparison.
These are some samples of the current format:
12/01/10 at 8:00PM
12/31/10 at 12:00PM
12/10/09 at…
I've currenly trying to pull out dates from a file and feed them directly into an array. My regex is working, but I have 6 groups in it, all of which are being added to the array, when I only want the first one.
@dates = (@dates, ($line =~ /((0[1-9]|[12][0-9]|3[01])(\/|\-)(0[1-9]|1[0-2])(\/|\-)([0-9][0-9][0-9][0-9]|[0-9][0-9]))/g ));
is there…
I am trying to cleanup a string coming from a search box on a multi-language site.
Normally I would use a regex like:
$allowed = "-+?!,.;:\w\s";
$txt_search = preg_replace("/[^" . $allowed . "]?(.*?)[^" . $allowed . "]?/iu", "$1", $_GET['txt_search']);
and that works fine for English texts.
However, now I need to do the same when the texts…
I have this Regex;
<(\d+)(\w+\s\d+\s\d+(?::\d+){2})\s([\w\/.-])(.)
What I want to do is to return FALSE(Not matched) if the third group is "MSWinEventLog" and returning "matched" for the rest.
<166Apr 28 10:46:34 AMC the remaining phrase
<11Apr 28 10:46:34 MSWinEventLog the remaining phrase
<170Apr 28 10:46:34 Avantail the…
This is the regular expression used for "shortcodes" in WordPress (one for the whole tag, other for the attributes).
return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)';
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
It…
What should be the regexfor matching date of any format like
26FEB2009
30 Jul 2009
27 Mar 2008
29/05/2008
27 Aug 2009
What should be the regular expression for that ?
I have regex that matches with 26-Feb-2009 and 26 FEB 2009 with but not with 26FEB2009. So if any one know then please update it.
…
I am trying to parse a PDF to extract the text from it (please don't suggest any libraries to do this, as this is part of learning the format).
I have already handled deflating it to put it in the alphanumeric format. I now need to extract the text from the text blocks.
So, my current pattern is…
MetaMap files have following lines:
mappings([map(-1000,[ev(-1000,'C0018017','Objective','Goals',[objective],[inpr],[[[1,1],[1,1],0]],yes,no)])]).
The format is explained as
mappings(
[map(negated overall score for this mapping,
[ev(negated candidate score,'UMLS concept…
I'm trying to come up with a regex to be able to parse the following type of strings into groups.
<link rel="alternate" type="application/rss+xml" title="[!PageTitle!]" href="[!SiteRoot!]/feed.xml" />
My regular expression is:
\[\!(.+)\!\]
The problem with this expression is that…
Hello,
I've seen around the web the following regex
(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
which validates only if the string:
* contain at least (1) upper case letter
* contain at least (1) lower case letter
* contain at least (1) number or special…
Hi, my date formatting in PHP is d-M-Y and I'm trying to match the dates with a javascript regex:
s.match(new RegExp(/^(\d{1,2})(\-)(\w{3})(\-)(\d{4})$/))
To be used with the jQuery plugin, tablesorter. The problem is it's not working and I'm wondering why not.
I tried removing the…
Below is an example that is producing an exception in Java (and not matching the input). Perhaps I misunderstood the JavaDoc, but it looks like it should work. Using the same pattern and input in C# will produce a match.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
…
I have this:
/**
* @file
* API for loading and interacting with modules.
* More explaination here.
*
* @author Reveller <me@localhost>
* @version 19:05 28-12-2008
*/
I'm looking for a regex to strip all but the @token data, so the result would be:
@file API for…
Hi all,
Am a newbie to iphone programming.
i have a input box and the user can write his DOB(mm/dd/yyyy) into the box.
Before i save the data i like to test for valid input. I am using Regexlite.h and Regexlite.m.i have the regular expression too. i want to compare the regex…
In PostgreSQL, there is a BLOB datatype called bytea. It's just an array of bytes.
bytea literals are output in the following way:
'\\037\\213\\010\\010\\005`Us\\000\\0001.fp3\'\\223\\222%'
See PostgreSQL docs for full definition of the format.
I'm trying to construct a…
I've been trying to figure out how to write this regular expression. It is to be used for ISAPI_Rewrite, a module for IIS 6, for doing URL rewriting.
I want the url /hg/<parameter> to be mathed, so it can be rewrited to /hg/hgwebdir.cgi/<parameter>.
I've…
I have am working on a multi language file. My urls look something like this:
http://www.mydomain.com/en/about/info
http://www.mydomain.com/nl/about/info
Now I use a small regex script that redirect the user when they use a link without language. The script looks…
I'm currently trying to wrap my head around regex, I have a validation snippet that tests an input box against a regex-expression:
$.validator.addMethod("customerName", function(value, element){
return (/^[a-zA-Z]*$/).test(value);
}, "Some text");
That works…
I am trying to perform literal match with regular expression using wildcard.
string utterance = "Show me customer id 19";
string pattern 1 = "*tom*";
string patter 2 = "*customer id [0-9]*";
Desired results:
if (Regex.IsMatch(utterance, pattern 1 ))
{…
Hi. I'm currently developing a little browser-based Twitter widget.
Currently, I'm stuck with getting the URLs to work. I'm kinda newbie, when it comes to regex (I know, how to get parts of a string, but this one – tough one).
So, I need a regex that would…
I'm writing a regular expression that can interactively validate SMTP responses codes, once the SMTP dialog is completed it should pass the following regex (some parentheses added for better readability):
^(220)(250){3,}(354)(250)(221)$
Or with(out)…
I'm trying to use regex to add a span to the first word of content for a page, however the content contains HTML so I am trying to ensure just a word gets chosen. The content changes for every page.
Current script is:
…