microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Please provide System.Text.RegularExpressions.Regex and MatchCollection #266

Closed megel closed 11 months ago

megel commented 7 years ago

For some reason we use Regex to Validate, Split and Repleace text by complex expressions.

Name := RegEx.Replace(Text, '[^a-zA-Z0-9_\w]', ' ');

FOREACH Item IN RegEx..Split(Line, ';|#') DO BEGIN // ... END;

StanislawStempin commented 7 years ago

Thanks, this is on our backlog.

bvbeek commented 7 years ago

Need this too

DanielGoehler commented 7 years ago

Would be very nice, e.g. for an advanced check if the E-Mail Address is valid:

procedure CheckValidEmailAddress(EmailAddress : Text);
  var
    RegEx : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Text.RegularExpressions.Regex";
    RegExOptions : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Text.RegularExpressions.RegexOptions";
    RegExPattern : Text;
  begin
    RegExPattern := '\A(?:[a-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z';
    if not RegEx.IsMatch(EmailAddress, RegExPattern, RegExOptions.IgnoreCase) then
      ERROR(InvalidEmailAddressErr,EmailAddress);
  end;
FSharpCSharp commented 6 years ago

Is there anything new about this issue? We would also need access to these classes. That would be very helpful for many problems. The two functions in the above-mentioned code unit are not sufficient to perform everything with regular expressions. You should get access to the matches.

StanislawStempin commented 6 years ago

No updates yet. It is still on the backlog

josnelissen commented 6 years ago

We also use RegExReplace and RegExMatch for Enrichment of Ebanking (Dutch localization). So it would be very welcome so we can upgrade to extension

HegedusZsolt commented 5 years ago

Any update on this? We have found RegexReplace and IsMatch in codeunit 10, what is really cool, but we are still waiting for the MatchCollection.

kalberes commented 11 months ago

Should be part of teh system.app https://github.com/microsoft/BCApps/tree/main/src/System%20Application/App/Regex/src