Hi I'm reading some code and found re.compile("<@(U\S+)>"), I'm having some trouble to understand the <>. Can someone give an example that matches? I have tried in python interactive shell with '<@U>' or '<@jyx>' and they do not match. Thanks.
1 Answer
<> have no significance as such.
You have to provide <@U then 1 or more non space characters then > to match.
Like
<@UASD> <@US> Your input
<@U> did not match as no non space character present after U <@asd> did not match as no U present after @ 1 Comment
dimo414
Just to clarify, you don't need a literal
S to match this regex (your current examples both have an S, which could confuse someone). <@Under> is another example that will match this pattern.
\S+means more than one none space character and it should come after<@Uand before>like<@Ua>;).