CloudSlang / cloud-slang

CloudSlang Language, CLI and Builder
http://cloudslang.io
Apache License 2.0
235 stars 82 forks source link

Incorrect retrieval of ')' inside default get_sp #920

Open lucian-cm opened 7 years ago

lucian-cm commented 7 years ago

check regex under Regexclass that is wrong wrong regex get_sp\\(\\s*'([\\w\\-.]+)'\\s*,\\s*(.+?)\\)

For test string _getsp('11.a', 'a)') the groups are 0: [0,18] get_sp('11.a', 'a) 1: [8,12] 11.a 2: [15,17] 'a

proposed solution get_sp\\(\\s*'([\\w\\-.]+)'\\s*,\\s*(.+)\\)

0: [0,20] get_sp('11.a', 'a)') 1: [8,12] 11.a 2: [15,19] 'a)'

Same thing needs to be checked for both single quotes and double quotes

levice14 commented 7 years ago

👍 I think it's nice to improve the regex

(however this is know issue -- the regex is not used to extract data just to detect whether get_sp is used -- the eval is pure python, false positives are admissible at this stage; it means we put the function in context but don't use it)