RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details (Win32) FormatMessage inserts and format fields extraction
Expression
(?<!%)(?:%%)*%(?(([1-9]\d?)!([\-\+0\ \#])?(\d+|\*)?(\.\*|\.\d+)?([hLIw]|l{1,2}|I32|I64)?([cCdiouxXeEfgGaAnpsSZ])!)|(?:([1-9]\d?)(?![!\d])))
Description
This expression matches all fields from the format string of the FormatMessage function. This is .NET version. It is based on Format Fields Specification at http://msdn.microsoft.com/en-us/library/56e442dc.aspx. According to format specification: %1-99[![flags][width][.precision][{h|l|ll|L|I|I32|I64|w}]type!] output match groups will contain: #1 or #7 - argument index, #2 - flags, #3 - width, #4 - precision, #5 - size prefix, #6 - type. If match #7 contains argument number then insert's format string (which is optional) is not specified and defaults to !s!.
Matches
%1!*.1s! | %21 | %4!lC! | %%%5!*s!
Non-Matches
%%23 | %01 | %23!d.2S! | %991
Author Rating: Not yet rated. Nikolay Eremin
Title Test Details 'C' printf/scanf format fields extraction
Expression
(?<!%)(?:%%)*%([\-\+0\ \#])?(\d+|\*)?(\.\*|\.\d+)?([hLIw]|l{1,2}|I32|I64)?([cCdiouxXeEfgGaAnpsSZ])
Description
This expression matches all fields from the format string of the printf/scanf functions. This is .NET version. It is based on Format Fields Specification at http://msdn.microsoft.com/en-us/library/56e442dc.aspx. According to format specification: %[flags][width][.precision][{h|l|ll|L|I|I32|I64|w}]type output matche groups will contain: #1 - flags, #2 - width, #3 - precision, #4 - size prefix, #5 - type.
Matches
%*.*s | %.3d | %lC | %s%%%02d
Non-Matches
%5.f | %++X | %@d | %232
Author Rating: The rating for this expression. Nikolay Eremin
   Displaying page 1 of 1 pages; Items 1 to 2

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials