[fpc-pascal] WideString and TRegexpr

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Sat Dec 3 17:10:56 CET 2011


Felipe Monteiro de Carvalho wrote:
> On Thu, Dec 1, 2011 at 7:48 PM, Mark Morgan Lloyd
> <markMLl.fpc-pascal at telemetry.co.uk> wrote:
>> Has anybody with experience of WideStrings tried compiling the "new" Regexpr
>> unit to support them?
> 
> Which "new" Regexpr? The one in packages/regexpr or another one?
> 
> I always thought that the one I added was focused on utf-8, although I
> only used it for ASCII so far.

The Sorokin one. I've been using it for years for ASCII, but it has an 
internal flag to use widestring:

// ======== Define options for TRegExpr engine
{.$DEFINE UniCode} // Unicode support
..
type
  {$IFDEF UniCode}
  PRegExprChar = PWideChar;
  RegExprString = WideString;
  REChar = WideChar;
  {$ELSE}
  PRegExprChar = PChar;
  RegExprString = AnsiString; //###0.952 was string
  REChar = Char;
  {$ENDIF}

It almost works: Exec() is OK (at least with trunk, I might have seen a 
problem with a version a few weeks old) but Match[] isn't.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list