View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005909 | JEDI VCL | 00 JVCL Components | public | 2012-06-14 14:00 | 2020-12-09 11:07 |
Reporter | Arioch | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | Daily / GIT | ||||
Target Version | Daily / GIT | Fixed in Version | |||
Summary | 0005909: RegExpr-validator is broken | ||||
Description | D:\DelphiProjects\Libs\JediVCL\jvcl\run\JvValidators.pas However introduced/copied/commited the change quoted below replaced RegExpr search with DOS file mask search. JvValidators demo is broken, but of course, who runs demo and who would use RegExpr anyway :-) The change below should be undone. It gets a bit beyond mere simplification | ||||
Additional Information | 589 7454 15.06.2004 9:39:36 marquardt //=== { TJvRegularExpressionValidator } ====================================== 590 2083 22.06.2003 14:09:41 peter3 591 11893 10.09.2008 0:45:14 obones function MatchesMask(const Filename, Mask: string{; 592 11893 10.09.2008 0:45:14 obones const SearchFlags: TSearchFlags = [sfCaseSensitive]}): Boolean; 593 6489 19.04.2004 3:55:47 ahuser {var 594 2083 22.06.2003 14:09:41 peter3 URE: TURESearch; 595 6489 19.04.2004 3:55:47 ahuser SL: TWideStringList;} 596 2083 22.06.2003 14:09:41 peter3 begin 597 6448 16.04.2004 21:28:30 peter3 Result := Masks.MatchesMask(Filename, Mask); 598 6448 16.04.2004 21:28:30 peter3 (* 599 2083 22.06.2003 14:09:41 peter3 // use the regexp engine in JclUnicode 600 2083 22.06.2003 14:09:41 peter3 SL := TWideStringList.Create; 601 2083 22.06.2003 14:09:41 peter3 try 602 2083 22.06.2003 14:09:41 peter3 URE := TURESearch.Create(SL); 603 2083 22.06.2003 14:09:41 peter3 try 604 2083 22.06.2003 14:09:41 peter3 URE.FindPrepare(Mask, SearchFlags); 605 2083 22.06.2003 14:09:41 peter3 // this could be overkill for long strings and many matches, 606 2083 22.06.2003 14:09:41 peter3 // but it's a lot simpler than calling FindFirst... 607 2083 22.06.2003 14:09:41 peter3 Result := URE.FindAll(Filename); 608 2083 22.06.2003 14:09:41 peter3 finally 609 2083 22.06.2003 14:09:41 peter3 URE.Free; 610 2083 22.06.2003 14:09:41 peter3 end; 611 2083 22.06.2003 14:09:41 peter3 finally 612 2083 22.06.2003 14:09:41 peter3 SL.Free; 613 2083 22.06.2003 14:09:41 peter3 end; 614 6448 16.04.2004 21:28:30 peter3 *) 615 2083 22.06.2003 14:09:41 peter3 end; | ||||
Tags | No tags attached. | ||||
|
Still present as of this writing 2016-04-01. (Wasted time today trying to use a regular expression validator for the first time. Why is this component not disabled until it's fixed?) |
2016-04-01 19:17
|
JvValidators.pas.patch (1,030 bytes)
jvcl/run/JvValidators.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jvcl/run/JvValidators.pas b/jvcl/run/JvValidators.pas index 249d2f0..ae80c07 100644 --- a/jvcl/run/JvValidators.pas +++ b/jvcl/run/JvValidators.pas @@ -41,7 +41,7 @@ uses JclUnitVersioning, {$ENDIF UNITVERSIONING} Windows, SysUtils, Classes, Controls, Forms, - JvComponentBase, JvErrorIndicator; + JvComponentBase, JvErrorIndicator, JclPCRE; type EValidatorError = class(Exception); @@ -618,9 +618,16 @@ end; procedure TJvRegularExpressionValidator.Validate; var R: string; + re : TJclAnsiRegEx; begin R := VarToStr(GetValidationPropertyValue); - Valid := (R = ValidationExpression) or MatchesMask(R, ValidationExpression); + Valid := (R = ValidationExpression); + if not Valid then + begin + re := TJclAnsiRegEx.Create; + re.Compile(ValidationExpression,False); + Valid := re.Match(R); + end; end; //=== { TJvCompareValidator } ================================================ |
|
Uploaded simple fix with JclPCRE.TJclAnsiRegEx, which fixes the component for my use case. Probably needs more testing/review. |
|
595 6489 19.04.2004 3:55:47 ahuser SL: TWideStringList;} 596 2083 22.06.2003 14:09:41 peter3 https://goo.gl/2DqXGj begin 597 6448 16.04.2004 21:28:30 peter3 Result := Masks.MatchesMask(Filename, Mask); 598 6448 16.04.2004 21:28:30 peter3 (* 599 2083 22.06.2003 14:09:41 peter3 // use the regexp engine in JclUnicode 600 2083 22.06.2003 14:09:41 peter3 SL := TWideStringList.Create; |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-06-14 14:00 | Arioch | New Issue | |
2012-06-14 14:00 | Arioch | Relationship added | related to 0005908 |
2012-06-14 16:21 | Arioch | Relationship added | parent of 0005912 |
2012-06-18 11:24 | obones | Status | new => acknowledged |
2016-04-01 18:12 | wprins | Note Added: 0021279 | |
2016-04-01 19:17 | wprins | File Added: JvValidators.pas.patch | |
2016-04-01 19:19 | wprins | Note Added: 0021280 | |
2020-12-09 11:07 | alexwriter | Note Added: 0021958 |