Re: Regex – Google Cloud Community

So I am writing a yaraL rule and I am stuck with a problem.

I want to write a regex to capture the domain part of a url. 

For example : 

For www.example.com/path, it captures example.com
For example.org, it captures example.org
For subdomain.example.co.uk/path, it captures subdomain.example.co.uk

my regex for this is : 

$domain = re.capture($e.any_variable, ” (?:https?:\/\/)?(?:www\.)?([^\/\s]+) “)

The error I am getting here is : 
tokenizing: unable to tokenize: invalid char escape

Can somebody help me with this. 

@AymanC  @jstoner 

 

Read more here: Source link