Recent

Author Topic: [SOLVED] Base64 Reg Exp using TRegExpr  (Read 3616 times)

Gizmo

  • Hero Member
  • *****
  • Posts: 831
[SOLVED] Base64 Reg Exp using TRegExpr
« on: October 16, 2012, 06:39:26 pm »
I need to parse data for Base64 strings that are not known in advance, so I need to use a reg exp to search for patterns of Base64.

Can anyone convert this Base64 Reg Exp that I found at StackOverflow (http://stackoverflow.com/questions/475074/regex-to-parse-or-validate-base64-data) to TRegExpr syntax because I don't think it will work as is because it's standard grep?

Code: [Select]
^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$

Many thanks

Ted
« Last Edit: October 17, 2012, 11:52:25 pm by tedsmith »

Gizmo

  • Hero Member
  • *****
  • Posts: 831
[SOLVED] Re: Base64 Reg Exp using TRegExpr
« Reply #1 on: October 17, 2012, 01:00:41 am »
This works, in that it returns Base64 data such as : VGhpcyBpcyBhIHNpbXBsZSBBU0NJSSBCYXNlNjQgZXhhbXBsZSBmb3IgU3RhY2tPdmVyZmxvdy4=

Code: [Select]
([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)
« Last Edit: October 17, 2012, 10:58:28 pm by tedsmith »

 

TinyPortal © 2005-2018