Regular expression problem

Discussion in 'Java' started by Sky Wong, Oct 25, 2004.

  1. Sky Wong

    Sky Wong Guest

    I would like to match this pattern
    <title>(any character including chinese except '<' and '>')</title>

    e.g.
    1) <title>一二三</title> --> should be matched
    2) <title>一二<三</title> --> should not be matched

    I can match both (1)&(2) by this Regular expression:
    <title>[\P{Cn}]*</title>, but after I change to RE to
    <title>[\P{Cn}-[<>]]*</title> (minus the '<' and '>'), (2) still can
    be matched, I don't know why.

    would someone help me to change the RE so that it can distinguish (1)
    and (2)?
    Sky Wong, Oct 25, 2004
    #1
    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. godfather2

    Regular Expression problem

    godfather2, Jul 20, 2003, in forum: Perl
    Replies:
    1
    Views:
    998
    Shawn Corey
    Jul 20, 2003
  2. VSK
    Replies:
    2
    Views:
    2,281
  3. Nazir
    Replies:
    3
    Views:
    5,061
    jayendra gadhavi
    Jan 2, 2008
  4. =?iso-8859-1?B?bW9vcJk=?=

    Matching abitrary expression in a regular expression

    =?iso-8859-1?B?bW9vcJk=?=, Dec 1, 2005, in forum: Java
    Replies:
    8
    Views:
    839
    Alan Moore
    Dec 2, 2005
  5. GIMME
    Replies:
    3
    Views:
    11,942
    vforvikash
    Dec 29, 2008
Loading...

Share This Page