Hello Michael,

Thank you for Your email. You gave me solution about I thought before
(variant B). But let's me try to explain exactly what I want to do.

Imagine I design textfield component what uses regular expression to
validating of entering text. This pattern is given by user of my
component in target application. So I don't know what expression will
be apply to validation.
When the enduser try to typing of characters in target application
to the component it (component) should accept only characters allowed
by pattern on desired position eg.
pattern: [0-9]-
text entered now in component: 123
and when the enduser try to enter '.' character on current (at the end
of '123' string) position then my component should reject it and content of
component should stay unchanged. But when enduser would to type '-'
character then component should to accept it and in my component
text '123-' should apears.

In addition when enduser want to leave text component and focus on another
component on filled form (in application) my component should match
whole typed text and accept or refuse it - eg.
pattern: [0-9]-
text entered now in component: 123
Matching on exit will return with false result.
But when enduser will have '123-' text in component on exit then
matching should return true result.

Pattern matching to my component is applying by designer of
application (or form designer), so I don't know what it will be.
I can't assume any of form of this one.

So.
I would one pattern applyed by application designer (in possibly short
form) will by using to partially (during text typing inside component)
and full (on exit from component) matching.

My question is: Is this possible?

I imaging that my pattern match input characters and after processing
can estabilish:

1. what character from beginning of processed text don't match to
pattern
AND
2. what character from beginning of pattern don't match to input
characters.

:-)

I want to avoid writing much complicated expression like:
[0-9]{0,3}|
[0-9]{3}-?|
(([0-9]{3}-[0-9]{0,3}|
  [0-9]{3}-[0-9]{3}-?|
  [0-9]{3}-[0-9]{0,2}|
  [0-9]{3}-[0-9]{2}-?|
  [0-9]{3}-[0-9]{0,2})|
 ([0-9]{3}-[0-9]{0,2}|
  [0-9]{3}-[0-9]{2}-?|
  [0-9]{3}-[0-9]{0,2}|
  [0-9]{3}-[0-9]{2}-?|
  [0-9]{3}-[0-9]{0,3}))
what care about all transient form my expected input,
but entering pattern in most short form
[0-9]{3}-([0-9]{3}-[0-9]{2}-[0-9]{2}|[0-9]{2}-[0-9]{2}-[0-9]{3})
to achieve entering both kind of form (both should be accepted):
nnn-nnn-nn-nn
OR
nnn-nn-nn-nnn

That's all.

Sorry for:
1. huge (and not optimized) expression,
2. email :-),
3. language.

And thank You for help.

Best regards
Jerzy Kut


Friday, June 06, 2003, 3:50:01 PM, you wrote:

MR> Hi Jerzy,

MR> I don't think that you can express this using one regular expression.

MR> I see two tactics.

MR> A)
MR> You create an array with an one character regular expression
MR> for every input position.
MR> You would than check the just entered character against the corresponding
MR> array
MR> index (maybe it's not at the end of input string).

MR> B)
MR> You have a regular expression for every length of the input string
MR> \d{1}
MR> \d{2}
MR> \d{2}-
MR> \d{2}-\d{1}
MR> aso
MR> Maybe you have pretty ideas in building it up.

MR> Regards
MR> Michael

MR> -----Ursprüngliche Nachricht-----
MR> Von: Jerzy Kut [mailto:[EMAIL PROTECTED]
MR> Gesendet: Freitag, 6. Juni 2003 14:54
MR> An: [EMAIL PROTECTED]
MR> Betreff: matching a part of expression


MR> Hello oro-users,

MR> I want to test what part of pattern matches to input character stream.
MR> My goal is to avoid entering of bad characters on caret during typing in
MR> textfield
MR> and matching whole expression on textfiled focus exit.
MR> I would to have one pattern for all matching (applyed by user).

MR> E.g.

MR> pattern: [0-9]{3}
MR> input:   0

MR> should passed partially matching but not passed full matching
MR> but

MR> input:   000

MR> should passed both tests.

MR> Is this possible? Or is any method to do it?
MR> Please don't say me that I can do it by apply pattern like:

MR> [0-9]{0,3}

MR> :-)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to