klorenz / atom-regex-railroad-diagrams

display regex as railroad diagram, if cursor moves to it
MIT License
250 stars 31 forks source link

My cursor stop and click the current ``regex`` line,But no graphic reflection #82

Closed hebijiandai closed 7 years ago

hebijiandai commented 7 years ago
import re
import requests
from pprint import pprint

url = "https://kyfw.12306.cn/otn/resources/js/framework/station_name.js?station_version=1.8983"
response = requests.get(url, verify=False)
stations = re.findall(u'([\u4e00-\u9fa5]+)\|([A-Z]+)', response.text)
pprint(dict(stations), indent=4)

qq 20161213125557

Hello sir,My cursor stop and click the current regex line,But no graphic reflection

I have enable the package.

How to solve this?Many thanks.

klorenz commented 7 years ago

@hebijiandai, in python language atom only recognizes r"" strings as regular expressions. Unicode strings are treated as normal strings. in this case (in your code) simple replacing the u with an r should do it (and code should still work). Apart from this there is a new feature, that you can select text and hit ctrl-r ctrl-r for displaying the railroad diagram