Re: [PATCH] [Outreachy] git/userdiff.c fix regex pattern error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ananya,

thank you for taking the time to write this patch!

On Thu, 4 Oct 2018, Ananya Krishna Maram wrote:

> the forward slash character should be escaped with backslash. Fix
> Unescaped forward slash error in Python regex statements.
> 
> Signed-off-by: Ananya Krishna Maram<ananyakittu1997@xxxxxxxxx>

That explains pretty well what you did, but I wonder why the forward slash
needs to be escaped? I would understand if we enclosed the pattern in
`/<regex>/`, as it is done e.g. in Javascript, but we do not...

Thanks,
Johannes

> ---
>  userdiff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/userdiff.c b/userdiff.c
> index f565f6731..f4ff9b9e5 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -123,7 +123,7 @@ PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
>  	 /* -- */
>  	 "[a-zA-Z_][a-zA-Z0-9_]*"
>  	 "|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
> -	 "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
> +	 "|[-+*\/<>%&^|=!]=|\/\/=?|<<=?|>>=?|\\*\\*=?"),
>  	 /* -- */
>  PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
>  	 /* -- */
> -- 
> 2.17.1
> 
> 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux