Re: Prefixes of regular expressions



On Jun 30, 1:12 am, "Arved Sandstrom" <asandst...@xxxxxxxxxxxxx>
wrote:
Define two regular expressions: one for valid (green), and one for valid
prefix (yellow). Match the supplied string against the first; if matched,
display green. If no match, match against the second. If matched, display
yellow; if no match, display red. You lose nothing in responsiveness with
two regular expressions - this is a user-typed form field after all. And the
logic becomes more clear.

For some situations you could probably use groupCount() on the Matcher
object, with capturing groups, to distinguish between a valid prefix and a
valid complete string.

AHS
Indeed, such an approach would work. But, logically speaking, I only
need
one regular expression to do this, not two. And by using two, I need
to manually
construct the prefix regex based on the whole string regex, when
logically
the former can be derived from the latter.

Maybe its time for a trip to bugs.sun.com... Who knows, I might see
the functionality
I'm after in J2SE 12.0 :)

Simon

.



Relevant Pages

  • Re: Prefixes of regular expressions
    ... prefix. ... Match the supplied string against the first; ... If matched, display ... For some situations you could probably use groupCounton the Matcher ...
    (comp.lang.java.programmer)
  • Re: A Simple BMP Converter
    ... "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal ... Private Sub cmdSysInfo_Click ... Open Registry Key ... > color bar in the color display. ...
    (comp.lang.basic.visual.misc)
  • Re: help collecting data.
    ... Dim GetC As String ... the code in the cell that I want the order numbers(info from column C ... "Otto Moehrbach" wrote: ... display them both, seperated by a comma ...
    (microsoft.public.excel.misc)
  • bugs in .NETCF SP2
    ... XmlDocument.CreateNode(XmlNodeType, String, String) specifying a ... namespace as third parameter creating an element node will set the ... automatically a prefix in the XmlNode.OuterXml property. ... OuterXml property just uses the localname without prefix. ...
    (microsoft.public.dotnet.framework.compactframework)
  • bugs in .NET compact framework
    ... XmlDocument.CreateNode(XmlNodeType, String, String) specifying a ... namespace as third parameter creating an element node will set the ... automatically a prefix in the XmlNode.OuterXml property. ... OuterXml property just uses the localname without prefix. ...
    (microsoft.public.pocketpc.developer)