Hi,
I need a regular expression to validate a timestamp of the format, using Javascript:
YYYY/MM/DD HH:MI:SS
I tried cooking up a few, but seems my regex skills fail to cover something or other.
Please give me a reference or way to do it.
P.S. : I mention regex, only as a suggestion. Im using Javascript and welcome any alternative.
I'm getting this error: Data type mismatch in criteira expression when trying to execute this query in access:
select sum(total_sum) from totals_table where tot_date = '3/01/2010' and tot_date < '4/01/2010'
P.S. tot_date is of type Date/Time and tot_sum is of type Number
Hi,
Can anybody help me writting a regular expression to replace these characters with a empty string. Character list is given below.
public static char[] delimiters = { ' ', '\r', '\n', '?', '!', ';', '.', ',', '`', ':', '(', ')', '{', '}', '[', ']', '|', '\'', '\\', '~', '=', '@', '>', '<', '&', '%', '-', '/', '#' };
Thanks.
Subrat.
Hi All!
I have an expression-- {YYYY}-{MM}
I have a textbox in that i will take input from user.
User must input in above format
for eample, {2010}-{03} or {10}-{3} or {2010}-{3}
How to validate this using Java script
Please help me to solve this.
Thank You
Hi,
I need a regex expression (PCRE) to match a integer number inside a string, being the string like : image89.jpg
I've tried many options without success.
I'm using preg_replace() by the way
My last attempt :
preg_replace('(\d+)', '$1', 'image89.jpg');
I have a simple doc.xml file which contains a single root element with a Timestamp attribute:
<?xml version="1.0" encoding="utf-8"?>
<root Timestamp="04-21-2010 16:00:19.000" />
I'd like to validate this document against a my simple schema.xsd to make sure that the Timestamp is in the correct format:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:attribute name="Timestamp" use="required" type="timeStampType"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="timeStampType">
<xs:restriction base="xs:string">
<xs:pattern value="(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
So I use the lxml Python module and try to perform a simple schema validation and report any errors:
from lxml import etree
schema = etree.XMLSchema( etree.parse("schema.xsd") )
doc = etree.parse("doc.xml")
if not schema.validate(doc):
for e in schema.error_log:
print e.message
My XML document fails validation with the following error messages:
Element 'root', attribute 'Timestamp': [facet 'pattern'] The value '04-21-2010 16:00:19.000' is not accepted by the pattern '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}'.
Element 'root', attribute 'Timestamp': '04-21-2010 16:00:19.000' is not a valid value of the atomic type 'timeStampType'.
So it looks like my regular expression must be faulty. But when I try to validate the regular expression at the command line, it passes:
>>> import re
>>> pat = '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}'
>>> assert re.match(pat, '04-21-2010 16:00:19.000')
>>>
I'm aware that XSD regular expressions don't have every feature, but the documentation I've found indicates that every feature that I'm using should work.
So what am I mis-understanding, and why does my document fail?
A frequent issue in code reviews is whether a numeric value should be hard-coded in the code or not. Does anyone know of a nice regular expression that can catch 'magic numbers' in code like:
int overDue = 30;
Money fee = new Money(5.25D);
without also getting a ton of false positives like for loop initialization code?
for (int i = 0; i < array.length; i++) {
}
I am getting uncaught exception: Syntax error, unrecognized expression: [@name='rbRewSelectionGroup'] when I load the page:
<script language="javascript">
$("input[@name='rbRewSelectionGroup']").click(function()
{
$(this).closest("form").submit();
});
</script>
I am not seeing it. I do not see anything wrong with this code at all. I do have the jQuery (1.4.2) library loaded with the page.
can any one tell me regular expression for postalcode of Amsterdam, Netherlands for validation
EX. 1113 GJ
Postal code format according to Wikipedia (thanks to Pekka):
1011–1199 plus a literal suffix AA-ZZ,
e.g. 1012 PP
Sorry for the potentially dumb question but I am trying to pull together a regular expression that will allow:
A number with 1 or 2 numbers before a decimal point, and 0-6 numbers after the decimal point. However I also need to allow the field to be blank if so required.
Valid Examples
0.952321
1.20394
12.12
25
Blank
Invalid Examples
123.45678
1.1234567
Please can anyone help?
Related to my previous question, I have a string on the following format:
this {is} a [sample] string with [some] {special} words. [another one]
What is the regular expression to extract the words within either square or curly brackets, ie.
{is}
[sample]
[some]
{special}
[another one]
Note: In my use case, brackets cannot be nested. I would also like to keep the enclosing characters, so that I can tell the difference between them when processing the results.
I have texts like this one:
this is a text in [lang lang="en" ]english[/lang] or a text in [lang lang="en" ]spanish[/lang]
I need to substitute them for:
this is a text in <span lang="en">english </span> or a text in <span lang="es">spanish</span>
I need a regular expression, not a simple replace. The languages in the lang tag can be whatever.
I receive Date and time from CSV file
The received Date format is YYYMMDD (string) (there is no ":" ,"-","/" to
separate Year month and date).
The received time format is HH:MM (24 Hour clock).
I have to validate both so that (example) (i) 000011990 could be invalidated for date (ii) 77:90 could be
invalidated for time.
The question is ,
Regular expression is the right candidate for do so (or) is there any other way to achieve
it?
I have a HTML page and I want to fetch the result between two tags <b> and <BR>
<b>Defendants Name:</b>Donahue, Leah A <BR>
What is the regular expression to fetch the words between these two tags
Sorry if this question is answered already. But I didn't find suitable answer.
I am having a string expression in C# which I need to convert to an int value or decimal anything. For example,
string strExp="10+20+30";
output should be=60.
how shall I do that???
Hello,
I would like a regular expression in this format. It Must match one of the following formats:
* (###)###-####
* ###-###-####
* ###.###.####
* ##########
Strip all whitespace. Make sure it's a valid phone number, then (if necessary) translate it to the first format listed above.
I have text that looks like:
My name is (Richard) and I cannot do
[whatever (Jack) can't do] and
(Robert) is the same way [unlike
(Betty)] thanks (Jill)
The goal is to search using a regular expression to find all parenthesized names that occur anywhere in the text BUT in-between any brackets.
So in the text above, the result I am looking for is:
Richard
Robert
Jill
Dear Masters! Is it possible to ensure, that only characters with codes between 0 and 255 will be accepted by regular expression, but all with the codes up to 256 not? Thank you!
I am looking for a regular expression (or other method if there is such a thing) for detecting bounce email messages. So far I have been going through our unattended mail box and adding strings that I find into a regex. I figured someone would have something that is already complete rather than me re-inventing the wheel.
Here is an example of what I have so far:
/reason: 550|permanent fatal errors|Error 550|Action: Failed|Mailbox does not exist|Delivery to the following recipients failed/i
Hi I'm trying to setup a RegexpValidator that only accepts a string of alphanumeric characters between 6-30 characters long and requires one number. I'm new to Regular Expressions and everything I've tried seems to keep returning an invalid ValidationRsultEvent. Here's a chunk of code:
<mx:RegExpValidator id="regexValidator" source="{passwordInput}" property="text"
triggerEvent="" valid="onPasswordValidate(event)" invalid="onPasswordValidate(event)" />
private function validateRegister():void
{
regexValidator.expression = "^(?=.*(\d|\W)).{6,30}$";
regexValidator.validate();
}
Hi,
I have a ListView and ObservableCollection in my wpf application.
I want to bind linq expression to ListView:
lv_Results.DataContext = store.Where(x => x.PR > 5);
But when i add new elements to store collection, lv_Results doesnt updates.
How can i update ListView?
I am trying to fix a regular expression i have been using in php it finds all find filenames within a sentence / paragraph. The file names always look like this: /this-a-valid-page.php
From help i have received on SOF my old pattern was modified to this which avoids full urls which is the issue i was having, but this pattern only finds one occurance at the begging of a string, nothing inside the string.
/^\/(.*?).php/
I have a live example here: http://vzio.com/upload/reg_pattern.php
Hey everybody,
I am a novice TCL programmer.Here I go My 1st post with stackoverflow forum. I would like to write a regular expression that matches any & only the strings starts with character A and ends with B. Whatever the characters coming inbetween should be displayed. For instance AXIOMB as an input from the user which starts with A & end with character B. Here is my try regexp { (^A([C-Z]+)B$)} Thank you