python-user-agents icon indicating copy to clipboard operation
python-user-agents copied to clipboard

How to modify regexes.yaml and make it work?

Open vnnw opened this issue 10 years ago • 0 comments

I found some mobile Android devices' brand were incorrectly recognized as "Generic_Android", so I tried to modify regexes.yaml. But when I re-imported ua parse, it didn't work.

For example, the original setting for Xiaomi is #########

XiaoMi

@ref: http://www.xiaomi.com/event/buyphone

######### regex: '; (MI \d[^;/]|MI-ONE Plus) Build/' device_replacement: 'XiaoMi $1' brand_replacement: 'XiaoMi' model_replacement: '$1'

I rewrote the pattern as below, but it didn't work as I expected.

  • regex: '; (MI \d[^;/]|MI-ONE Plus|HM \w[^;/]*) Build/'

The user agent string is this: "Mozilla/5.0 (Linux; Android 4.4.4; HM NOTE 1LTE Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 Wochacha/8.3.0"

vnnw avatar Sep 30 '15 09:09 vnnw