Regex help

Discussion in 'Perl' started by rdimayuga, Sep 30, 2003.

  1. rdimayuga

    rdimayuga Guest

    I need a regex pattern that will match a string starting with zero or
    one dot's. For example, ".string" and "string" should both match, but
    something like "estring" should not match. So far, I've tried the
    following:

    \.*string
    [.]{0,1}string
    [\.]{0,1}string
    [^a-zA-z0-9]{0,1}string

    and none of these do the job 100%. I'm also wondering if there might
    be a bug in the regex library i'm using - it's a 3rd party class that
    somebody before me found and implemented. I have the source code for
    the regexp class if necessary. Any help would be appreciated. Please
    reply to .
    rdimayuga, Sep 30, 2003
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    (rdimayuga) wrote in
    news::

    > I need a regex pattern that will match a string starting with zero or
    > one dot's. For example, ".string" and "string" should both match, but
    > something like "estring" should not match. So far, I've tried the
    > following:
    >
    > \.*string
    > [.]{0,1}string
    > [\.]{0,1}string
    > [^a-zA-z0-9]{0,1}string
    >
    > and none of these do the job 100%. I'm also wondering if there might
    > be a bug in the regex library i'm using - it's a 3rd party class that
    > somebody before me found and implemented. I have the source code for
    > the regexp class if necessary. Any help would be appreciated.


    Well, if you're using a 3p regex library and not Perl's regexes, then who
    knows. I know Perl's regexes -- other regex languages vary widely.

    I would suggest, perhaps, that your regex needs to be anchored at the
    start of the string in order to work.


    > Please
    > reply to .


    Sorry, no. That's not how usenet works. Answers to questions are posted
    publicly so that all may benefit.

    Also, for your future reference, comp.lang.perl is a defunct newsgroup.
    You'll get a better response if you post to comp.lang.perl.misc; that's
    the newsgroup for general Perl questions.

    - --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBP3q8sGPeouIeTNHoEQJE2wCfQR4zi6kxp1ir24xnPchrsu0NIO0AnjFz
    Rp7DmsLiPBgIHDKrJ8fomcXv
    =/LtP
    -----END PGP SIGNATURE-----
    Eric J. Roode, Oct 1, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    683
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Rick Venter

    perl regex to java regex

    Rick Venter, Oct 29, 2003, in forum: Java
    Replies:
    5
    Views:
    1,598
    Ant...
    Nov 6, 2003
  3. Replies:
    2
    Views:
    585
  4. Xah Lee
    Replies:
    1
    Views:
    924
    Ilias Lazaridis
    Sep 22, 2006
  5. Replies:
    3
    Views:
    716
    Reedick, Andrew
    Jul 1, 2008
Loading...

Share This Page