Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] RegExp for positive integer


  • From: javascript@xxxxxxxxxx (Dan Costea)
  • Subject: [Javascript] RegExp for positive integer
  • Date: Thu, 23 May 2002 10:56:05 -0700

This is a multi-part message in MIME format.

------=_NextPart_000_004C_01C20248.6F998C70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I found it! the correct RegExp is: var reSignedInteger =3D /^\+?\d+$/;

  ----- Original Message -----=20
  From: Dan Costea=20
  To: javascript@xxxxxxxxxx=20
  Sent: Thursday, May 23, 2002 9:52 AM
  Subject: [Javascript] RegExp for positive integer


      Hi,

  I want to define a regular expression for a positive integer. So I =
wrote:

  var rePosInteger =3D /^(+)?\d+$/;

  but I receive the error: "Expected quantifier". Can you tell me where =
is my mistake?


  Thank you, Dan.

------=_NextPart_000_004C_01C20248.6F998C70
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I found it! the correct RegExp is: =
<FONT=20
face=3D"Times New Roman" size=3D3>var reSignedInteger =3D=20
/^\+?\d+$/;</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Dcostea.dan@xxxxxxxxxxxxxxx=20
  href=3D"mailto:costea.dan@xxxxxxxxxxxxxxx";>Dan Costea</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Djavascript@xxxxxxxxxx=20
  href=3D"mailto:javascript@xxxxxxxxxx";>javascript@xxxxxxxxxx</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, May 23, 2002 =
9:52=20
AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Javascript] RegExp =
for positive=20
  integer</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Hi,</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>I want to define a regular expression =
for a=20
  positive integer. So I wrote:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>var rePosInteger =3D =
/^(+)?\d+$/;</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>but I receive the error: "Expected =
quantifier".=20
  Can you tell me where is&nbsp;my mistake?</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Thank you,=20
Dan.</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004C_01C20248.6F998C70--