BNF for uniform resource location token using regex working in live preview but fail in application

Answered

I am developing custom language and want to identify url token. Currently I am having following in bnf file

url="regexp:(https?://(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*))"

This is working in live preview,

but not in application it shows bad character for ":"

What is the correct way of identifying this type of token, I am new to this and found this w3 spec for url bnf here https://www.w3.org/Addressing/URL/5_BNF.html is this the correct way?

0
5 comments

Going witch such regex right on the BNF level may not be the best way to handle URLs.

What's your goal regarding these URLs?

0

I just need to identify it as a url. What is the best way to do it? I am beginner for BNF and language plugin development.

0

> I just need to identify it as a url.

Ok, but what for?

0

Hit the url and get a response. Basically no plans for identifying tokens separately. What would be the best way to achieve this?

0

I'd avoid looking for the URLs in BNF using regex and handle it with lang.parserDefinition

0

Please sign in to leave a comment.