|
|
This is for sure not gonna work:
1 - Group # 3 & 4 are particularly useless.
2 - You only allow ~ and ! to come before a single @ (not escaped)
3 - Escape characters for [, ], " and @ are not allowed.
Thank you for your help, anyways.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
According to the RFC the first part can use any ASCII char except control chars (0-31), white-space (32), @, =, " and ]. After that must come a @ (one and only one!). The last part is made of digits optionally separated by . (dot)...
At least that what I understood...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: char except control chars (0-31), white-space (32),
true, but your regex only allows ! and ~
Kornfeld Eliyahu Peter wrote: @, =, " and ].
They must be escaped, e.g. @ as \@.
Kornfeld Eliyahu Peter wrote: After that must come a @ (one and only one!).
true that
Kornfeld Eliyahu Peter wrote: The last part is made of digits optionally separated by . (dot)...
Well... Yes. Sorry that I overread that.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Marco Bertschi wrote: true, but your regex only allows ! and ~
Wrong. I have [!-~] - it means everything from ! to ~
Marco Bertschi wrote: They must be escaped, e.g. @ as \@.
According to RFC they are can't take part - no mentioning of escapes!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: According to RFC they are can't take part - no mentioning of escapes!
My bad, I forgot to paste the respective part.
Quote: Inside PARAM-VALUE, the characters '"' (ABNF %d34), '\' (ABNF %d92),
and ']' (ABNF %d93) MUST be escaped. This is necessary to avoid
parsing errors. Escaping ']' would not strictly be necessary but is
REQUIRED by this specification to avoid syslog application
implementation errors. Each of these three characters MUST be
escaped as '\"', '\\', and '\]' respectively. The backslash is used
for control character escaping for consistency with its use for
escaping in other parts of the syslog message as well as in
traditional syslog.
A backslash ('\') followed by none of the three described characters
is considered an invalid escape sequence. In this case, the
backslash MUST be treated as a regular backslash and the following
character as a regular character. Thus, the invalid sequence MUST
not be altered.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
OK. Now we are on the same page...
I thought we talking about SD-ID only, but you are after a SD-ELEMENT...
The regex you got is one for the SD-ID part, we need an other for the SD-PARAM part...
I will be on it ASAP...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I add my answer here as our little chat is loooooooooooooooong.
As I saw you try to verify a SD-ELEMENT according to rfc 5424 ...
SD-ELEMENT is build from SD-ID and SD-PARAM
SD-ID is build like
* any US-ASCII except @ , = , ] , " , whitesapce and control charaters
* a @
* one or more numbers separated by dot (. )
The regex for that is -
([!-~][^@=\]\"])+@(\d)+(\.(\d)+)*
SD-PARAM is build from PARAM-NAME and PARAM-VALUE . PARAM-NAME is the same as SD-ID ...
PARAM-VALUE build like
* any UTF-8
* the characters " , \ and ] must be escaped (by \ )
The regex for that is -
([^"\]\\]|(\\")|(\\])|\\{2})*
It's not clearly stated (or I missed) but seems to me that SD-ID and PARAM-NAME should not exceed the length of 32 characters...
I hope it helps...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Dear Peter,
thank you very much, I can't tell how much I appreciate your efforts!
Kornfeld Eliyahu Peter wrote: It's not clearly stated (or I missed) but seems to me that SD-ID and PARAM-NAME should not exceed the length of 32 characters...
This is true for SD-ID, but PARAM-NAME can be an UTF8 string of any length, as long as the mentioned characters are escaped.
I will not check this using the Regex since I will be faster just checking for string.Length .
The plan is that I will publish my RFC5424 implementation as article on CodeProject, and I will definitely mention your great efforts and help in regarding to the Regex stuff!
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
It was a very nice challenge - I liked it, and very happy to help...
Marco Bertschi wrote: This is true for SD-ID, but PARAM-NAME can be an UTF8 string of any length
RFC 5424:
SD-ID = SD-NAME
PARAM-NAME = SD-NAME
SD-NAME = 1*32PRINTUSASCII ; except '=', SP, ']', %d34 (")
According to this SD-ID and PARAM-NAME are the same - SD-NAME, and SD-NAME has a maximum of 32...
Marco Bertschi wrote: I will not check this using the Regex since I will be faster just checking for string.Length .
I'm not sure all you have to do is add {1,32} at the end of the regex instead of *...
Marco Bertschi wrote: I will publish my RFC5424 implementation as article on CodeProject
It must have to be an excellent quality - otherwise I will not let it pass moderation!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: According to this SD-ID and PARAM-NAME are the same - SD-NAME, and SD-NAME has a maximum of 32...
Me messed up again...
I meant PARAM-VALUE:
Quote: PARAM-VALUE = UTF-8-STRING ; characters '"', '\' and
; ']' MUST be escaped.
Kornfeld Eliyahu Peter wrote: It must have to be an excellent quality - otherwise I will not let it pass moderation!
As excellent as the other Articles I already submitted.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: SD-PARAM is build from PARAM-NAME and PARAM-VALUE . PARAM-NAME is the same as SD-ID ...
PARAM-VALUE build like
* any UTF-8
* the characters " , \ and ] must be escaped (by \ )
The regex for that is -
([^"\]\\]|(\\")|(\\])|\\{2})*
The idea was good,
but I managed to come up with a better solution:
(?<!\\)@|(?<!\\)\[|(?<!\\)\]|(?<!\\)"
Will produce a match whenever there is a string (@, [, ] or ") without a preceding \, which is more than sufficient for my use case.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
It's nice - but I hope you know that
(?<!match) is an extension that will not work in everywhere (I think it works only in python/.NET word)...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
It will also work with Perl, and the expression is widely supported (At least my clever book says that).
What differs are the restrictions for the lookbehind characters, e.g. Perl and Phyton only allow fixed length strings to look after, and different restrictions are allowed by different languages.
The (?match is what differences them.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Marco Bertschi wrote: my clever book
What book?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
Care to recommend here?
Useful Reference Books[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Added
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Hello XSockets.NET,
I am newbie, I am installing XSocket by command: Install-Package XSockets (http://xsockets.net/docs/video-tutorials), It complete. But, I can not see CodeTemplate folder in project
(I am using Package Manager Console Host Version 2.8.50126.400, VS 2010 SP1).
Please help me, how to show CodeTemplate folder???
|
|
|
|
|
If it has successfully installed the package, left click on the project that you have installed it into. Select the Project menu and then Show all files... If the folder is shown in the project now, open it up and right click on the files in there - choose Include in project
|
|
|
|
|
I have developed a c# application and when I tried to install it I figured out that some users don't have framework installed on their computers and for some business constraints they can't install it.
Is there a tool to convert my c# application to native one to be able to work on clean machines with out installing framework ?
|
|
|
|
|
Native code? Why?? There's no point to it.
If you want to avoid the .NET Framework, you have to spend some big'ish money. The only compiler I know of is not free, called Salamander[^]. It costs about $1300 per developer using it and it hasn't been updated since 2007.
Warning: Linking in the .NET Framework is NOT supported will result is HUGE executables!
|
|
|
|
|
What? You don't like 500Mb .EXE files? Luddite!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
After a couple of herniated disks, I was told by my doctor that I can't do any heavy lifting. So I can't generate a 500MB executable anymore.
|
|
|
|
|
My doctor said the same thing so now I have to sit to urinate.
|
|
|
|