regular expression won't match single digit

I am trying to create a regular expression for matching dates.  After finding 
that my regex pattern didn't work I decided to pare it down and see if I 
could figure out why.  Now I can't get the test to just match a single 
character and reject multiple characters.

So in my test I have myRegex.pattern = "[0-9]" and myRegex.test("15"), if I 
am not mistaken that regular expression should just match 1 digit right?  But 
15 returns true because it finds at least 1 of the digits that matches.

Am I doing something wrong?  thanks.
0
Utf
7/26/2010 2:31:25 PM
vb.general.discussion 1016 articles. 0 followers. Follow

9 Replies
634 Views

Similar Articles

[PageSpeed] 57

icccapital laid this down on his screen :
> I am trying to create a regular expression for matching dates.  After finding 
> that my regex pattern didn't work I decided to pare it down and see if I 
> could figure out why.  Now I can't get the test to just match a single 
> character and reject multiple characters.
>
> So in my test I have myRegex.pattern = "[0-9]" and myRegex.test("15"), if I 
> am not mistaken that regular expression should just match 1 digit right?  But 
> 15 returns true because it finds at least 1 of the digits that matches.
>
> Am I doing something wrong?  thanks.

^/d{1,1}$

-- 
Tom Shelton


0
Tom
7/26/2010 2:59:23 PM
Tom Shelton laid this down on his screen :
> icccapital laid this down on his screen :
>> I am trying to create a regular expression for matching dates.  After 
>> finding that my regex pattern didn't work I decided to pare it down and see 
>> if I could figure out why.  Now I can't get the test to just match a single 
>> character and reject multiple characters.
>>
>> So in my test I have myRegex.pattern = "[0-9]" and myRegex.test("15"), if I 
>> am not mistaken that regular expression should just match 1 digit right?  
>> But 15 returns true because it finds at least 1 of the digits that matches.
>>
>> Am I doing something wrong?  thanks.
>
> ^/d{1,1}$

Crap... wrong slash :)

^\d{1,1}$

-- 
Tom Shelton


0
Tom
7/26/2010 3:00:09 PM
"icccapital" <icccapital@discussions.microsoft.com> wrote in message 
news:20427EA5-D100-458D-8169-90EB43F6374F@microsoft.com...

>I am trying to create a regular expression for matching dates.  After 
>finding
> that my regex pattern didn't work I decided to pare it down and see if I
> could figure out why.  Now I can't get the test to just match a single
> character and reject multiple characters.
>
> So in my test I have myRegex.pattern = "[0-9]" and myRegex.test("15"), if 
> I
> am not mistaken that regular expression should just match 1 digit right? 
> But
> 15 returns true because it finds at least 1 of the digits that matches.
>
> Am I doing something wrong?  thanks.

I would think that you'd get two matches, the 1 and the 5. Perhaps it was 
the way you were accessing the matches that returned the full number. But 
since you didn't post any code.... 


0
Jeff
7/26/2010 5:42:19 PM
Thanks Tom, forgot the ^ and $.  That was helpful

"Tom Shelton" wrote:

> Tom Shelton laid this down on his screen :
> > icccapital laid this down on his screen :
> >> I am trying to create a regular expression for matching dates.  After 
> >> finding that my regex pattern didn't work I decided to pare it down and see 
> >> if I could figure out why.  Now I can't get the test to just match a single 
> >> character and reject multiple characters.
> >>
> >> So in my test I have myRegex.pattern = "[0-9]" and myRegex.test("15"), if I 
> >> am not mistaken that regular expression should just match 1 digit right?  
> >> But 15 returns true because it finds at least 1 of the digits that matches.
> >>
> >> Am I doing something wrong?  thanks.
> >
> > ^/d{1,1}$
> 
> Crap... wrong slash :)
> 
> ^\d{1,1}$
> 
> -- 
> Tom Shelton
> 
> 
> .
> 
0
Utf
7/26/2010 5:58:07 PM
icccapital was thinking very hard :
> Thanks Tom, forgot the ^ and $.  That was helpful
>

Cool...  Also, you can drop the quantifier :)  I don't know why I put 
that in.  Rusty, I guess :)

^/d$

-- 
Tom Shelton


0
Tom
7/26/2010 6:25:55 PM
"Tom Shelton" <tom_shelton@comcast.invalid> wrote in message 
news:i2kjvr$oha$1@news.eternal-september.org...

> Cool...  Also, you can drop the quantifier :)  I don't know why I put that 
> in.  Rusty, I guess :)
>
> ^/d$

HAHAHAHAHAHA!!! Look at the slash.... 


0
Jeff
7/26/2010 7:18:10 PM
Jeff Johnson submitted this idea :
> "Tom Shelton" <tom_shelton@comcast.invalid> wrote in message 
> news:i2kjvr$oha$1@news.eternal-september.org...
>
>> Cool...  Also, you can drop the quantifier :)  I don't know why I put that 
>> in.  Rusty, I guess :)
>>
>> ^/d$
>
> HAHAHAHAHAHA!!! Look at the slash....

DANG!  Did it again :)  Yi! Yi! Yiiii!

-- 
Tom Shelton


0
Tom
7/26/2010 7:24:21 PM
"Tom Shelton" <tom_shelton@comcast.invalid> wrote in message 
news:i2knde$8a8$1@news.eternal-september.org...
:
: DANG!  Did it again :)  Yi! Yi! Yiiii!
:

What did I tell you the other day?  Judge not?  Karma's a bitch, ass 

0
Kevin
7/26/2010 8:00:38 PM
Kevin Provance pretended :
> "Tom Shelton" <tom_shelton@comcast.invalid> wrote in message 
> news:i2knde$8a8$1@news.eternal-september.org...
>> 
>> DANG!  Did it again :)  Yi! Yi! Yiiii!
>> 
>
> What did I tell you the other day?  Judge not?  Karma's a bitch, ass 

LOL...  At least I know what a regex is, moron.

-- 
Tom Shelton


0
Tom
7/26/2010 8:41:21 PM
Reply:

Similar Artilces:

Annualized Budget for MS Office Accounting Express 2009
How can I create a budget using MS Office Accounting Express and use it to compare actual results on an annual basis. There is a group for accounting, they may also cover "accounting express" asidman wrote: > How can I create a budget using MS Office Accounting Express and use it to > compare actual results on an annual basis. ...

Use of Parntheses in Expressions
Hello, I am fairly new to Access and Excel. I am trying to write a formula/expression, but I think my problem is as simple as having the parenthese in the wrong place. The formula I have currently is as follows: Sum(((IIf([Mapping]![Pricing]="CPM",[TPImpressions]/1000*[Mapping]![Price],IIf([Mapping]![Pricing]="CPC",[TPClicks]*[Mapping]![Price],[TPConv]*[Mapping]![Price]))))*[Mapping]![Eye Engage Cost]))))) I basically want the SUM(IF part to be evaluated first and then multiply the result by [Mapping]![Eye Engage Cost] at the end. Currently, the formula abo...

Matching invoice not available on receiving that have been return
Hi, If I return without a credit in POP (because I never match the receiving with an invoice), the link should be made to assure that it is impossible to still match the receiving that includes the items that have been return with an invoice. I tested it and GP allow it. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and...

non-business cash flow forcast not matching with the same account'
This is the part about MS Money that I love and hate the most. I swear, if another program offered it I'd switch in a New York minute. That rant off my chest, here goes. I'm running MS Money 2007 Home and Business. I've been using Money for .. 10 years? I've had many problems with the forecast function. Currently I keep track of my checking account only in the forecast. I've gone through the Change Cash Flow Settings already and made sure none of the Trends, Budgets, Business etc were being included. It's showing that I have about $367 less at the lowest po...

Outlook Express SMTP error
Help please. I am rying to set up Outlook Express on a friend's computer. She can connect to the Internet via her ISP - talktalk.net (we're in the UK) - and open and view web pages in Explorer. She can receive emails from the mail.talktalk.net server but when trying to send emails via the smtp.talktalk.net server she keeps getting the following errror message: "An unknown error has occurred. Subject'Re: Whatever...', Account "Talktalk", Server 'smtp.talktalk.net', Protocol: SMTP, Server Response: '451 Error while writing spool file,' Port: ...

expression builder / dynamic report
Two questions: 1. Does anyone ahev any good websites to help me with the expression builder. I have written a VBA procedure, understand programming but have not found anythng to help me understand how (correctly) to use this tool to help me on my reports. (I think it can be very useful if I could just figure it out. 2. Is there a way to dynamically create a report based on a parameter or query? Hi AJ, I'll take a stab at your second question. You can dynamically create the WHERE clause of a SQL statement (or even the entire SQL statement) that serves as the recordsource for a repo...

Export to Outlook express #2
I have a number of email accounts and want to manage some in Outlook express and my main business one in Outlook. I've used Outlook for one account that now needs to go to OE - is it possible to export from Outlook to OE? TIA "Alan Davies" <alan@davies.info> wrote in message news:eGM9mGIAGHA.264@tk2msftngp13.phx.gbl... >I have a number of email accounts and want to manage some in Outlook >express > and my main business one in Outlook. > I've used Outlook for one account that now needs to go to OE - is it > possible to export from Outlook to OE? >...

16 digit number wont keep alteration unless format cell to text
Using excel 2000 recieving data from client with 16 numeral characters within cells cells show an abreviated listing for the number (2.06E+15) When editing the the number (wanting to change the last number by 1 digit) i.e. 2059510000000000 - change to - 2059510000000001 this change will not be kept?? I format the cell to "numbers" with no decimal point as a whole number is required Any ideas?? Is this number to long for excell 2000?? I'm not a big excel user Cheers Croc001 Excel, like most other spreadsheet programs, uses IEEE format for storing floating point numbers. Tha...

Setting up outlook express e-mail account
I am trying to set up an outlook express e-mail account. I am being told to click on e-mail acount under "tools" however e-mail is not listed under "tools" what should i do to send e-mail from microsoft Ehm; "send e-mail from microsoft" ??? Anyway; Tools-> Accounts... Also note that this is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Robert Sparnaaij [M...

Is there a way to match spreadsheets without using access?
in access I use unmatch to compare data files on excel worksheets. Using only excel, is there a way around access? There are a few ways I know to compare values in two worksheets... #1. There are ways to compare two worksheets (cell by cell--A1 with A1, X99 with X99, ...). Look at Myrna Larson and Bill Manville's compare program: http://www.cpearson.com/excel/whatsnew.htm look for compare.xla #2. You could create a new sheet with formulas that look at the cells on other sheets. Put this in A1 of the new sheet: =if(sheet1!a1=sheet2!a1,"","Different") ...

OutLook Express #236
When a message comes in it automatically opens up without any user intervention. I checked all over to see where I can prevent this from happening in the Outlook settings but I cannot seem to find it. Thanks, RR ...

Problem in sending mail via outlook express
I have setup gmail account in outlook express6 but while sending mail im getting message like your account is not configured for sending e-mail. pls help Hello, Did you check the right pop port?? gmail uses port 465 for SMTP not 25 (some say they use port 464). Have you checked the "server requires SSL? you need to check both (for pop and smtp). Have you checked "server requires aunthetication"?? you need to check that. After all those settings are correct, then you must log into your gmail account via its website and click on settings and go to "forwarding and pop&qu...

Can't Send Email From Outlook Express
I believe I have all configurations correct. I can receive emails, but everytime I send emails I get the error message that the system has unexpectedly been interrupted. Ask in an Outlook Express forum. This is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Roady [MVP] www.howto-outlook.com Tips of the month: -Creating Signatures -Create an Office XP CD slipstreamed with Service Pack 3...

Outlook Express transfer to Outlook
I want to save my existing email folders when I move to Outlook (on a new machine) but I can't seem to locate any tutorials on hoe to do this. Also, when I went to Export my Messages via EXPORT MESSAGES > All Folders > OK I get an error message: "The Export could not be performed. Your default MAPI store could not be opened" I am afraid to do anything if it might delete my existing mail folders on the old machine. First fully configure Outlook and then try the export again. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the O...

outlook express 5 help
I have a windows 2000 system that crashed. i backed up the outlook express folder and the applications data folder. I reinstalled Win2k. How do I import all the old Outlook express messages and address book on the new installation? Any help will be greatly appreciated. ...

Outlook 2003 and digital signing
I'm running Outlook 2003 against Exchange 2000. I've started using a Twarte personal email certificate. When I click Send, it pops up a dialog box about trying to access a protected item. I click OK and it works fine, but is there a way to avoid having to click this extra OK? -- -- Mark Warbeck mwarbeck@adelphia.net I think you are only given two levels of trust when you install the certificate: ask for permission and ask for permission with a password. This is possibly a good idea since use of the certificate requires authorisation. That authorisation might, however, be cache...

Outlook Express & Registry
Does anyone know what does it mean if the "Connection Type" key in the registry (in the outlook express account info in the registry) has a value of 0 ? I have an IMAP account on Win 2000, all the info is there, but the connection type is zero. This newsgroup is for support of Outlook 97, 98, 2000 & 2002 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x http://support.microsoft.com/newsgr...

Live Mail in Outlook express
I really like the consolidation of email accounts with Live Mail within Outlook express. My question is does anybody know of an add-on that will allow enable a personnal calander; the same or much like the calander in hotmail or msn email accounts? No. If you use vista, there is a calendar but its not part of mail - it’s a separate application. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscrib...

iif statement what is wrong with this expression
I've written the following statement and I'm getting the following error, the expression you entered has a function containing the wrong number of arguments. Iif([select]=1,"show",(iif(isnull([select]=true, (iif([HMO]=1, "show",(iif (isnull([HMO]=true,"show","dont show")) the iif function requires both an "if true value" and "if false value". your second iif function is missing one of these values (probably the true value judging by the way you have this setup) i assume that if [select] is null, you want &...

Find not match?
Is there way to get Find (Ctrl-F) to search for a non-match? I don't think so. On 09/24/2010 10:33, Prof Wonmug wrote: > Is there way to get Find (Ctrl-F) to search for a non-match? -- Dave Peterson On Fri, 24 Sep 2010 12:42:08 -0500, Dave Peterson <petersod@XSPAMverizon.net> wrote: >I don't think so. > >On 09/24/2010 10:33, Prof Wonmug wrote: >> Is there way to get Find (Ctrl-F) to search for a non-match? Wow. Here it is 2010 and the Office products do not have a basic search capability with standard codes. Amazing. The work-around I can up with was to ...

Need formula to return exact match
The following looks in Uses! A:A to find a match for B189 and then looks in C to find and return value, if present. IF(B189="","",IF(ISNA(VLOOKUP(B189,Uses!A:C,3,0)),"",VLOOKUP(B189,Uses!A:C,3,0))) I want now to return a particular value located in C:C Because there is now more than one possible matching record in Uses! A:A to match B189 and there may also be more than one non duplicate values in C:C the formula need to be able to know what value to return. To explain this better here is an example: B189 = “Toyota” “Toyota” can be found ...

outlook express
I use Windows XP Home edition Version 5.1.2600 SP1 and Outlook Express 6 version 6.00.2800 When I receive an e-mail with an attchment, I can't read the attachments with the extensions .DOC or .MDB or .TBL. I can see the attachments, but they are not highlighted. Attachments with the extension .JPG or.XLS are ok. Any idee what can cause this problem? My other pc with Windows ME and the same Outlook Express is working fine. Jan <jvanderlinden@quicknet.nl> wrote: > I use Windows XP Home edition Version 5.1.2600 SP1 and > Outlook Express 6 version 6.00.2800 Ask in an Outlo...

Match (1 of 3 cell values) in a range?
Wondering if it's possible to achieve the following without using OR's (i.e. via array formula or similar) I have product information in a straight data dump from our point of sale, and a table of categories, suppliers or product groups to exclude from further reports (in a single column list). Such that: D4 = Category E4 = Supplier I4 = Product group I want a response: If the category, or the supplier, or the product group is in the list of exclusions, then response should be "DO NOT REPLENISH" I can do it easily enough with a IF(OR(MATCH(D4......) [3...

Outlook Express attachments #3
I have just had XP Home Editioin rebuilt on my machine due to a problem and now fid that Outlook Express refuses to let em see any attachments, giving the following message "OE has removed access to the following unsafe attachments". Any ideas? could it be settings or something relating to Norton Atnivirus set up or . . .? You might look at OL2002:article #290497 at http://support.microsoft.com/default.aspx?scid=kb;EN- US;290497 >-----Original Message----- >I have just had XP Home Editioin rebuilt on my machine >due to a problem and now fid that Outlook Express ref...

Mtadata daon't match source
I work with VS2008 and Windows Vista. I added to my solution another dll but I get a compilation error in which there is a mismatch between paramters number in a method in the main project and the called method in the dll. Selcectin "Go To Definishin" in the method call pops up the matadata pane with unrelevent version of the dll. In another words the metadata version doesn't match the source in the dll. Clean and rebuild always ends up with similar error. Can someone advise please? Regards Mandy ...