We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const getCommunity = (address) => { const filterArea = (str) => { const temp = str.match(/(?<=(路\d+号)|(路\d+#)|(街\d+号)|(街道\d+号)|侧|组|镇|广陵区|邗江区|江都区|江都市|仪征市|高邮市|宝应县|扬州市).+/); return temp ? filterArea(temp[0]) : ['侧', '组', '路', '村', '道', '镇'].includes(str.slice(-1)) ? '' : str; } const filterSpecial = (str) => { const temp = str.match(/(?<=路|街道).+/); return temp ? filterSpecial(temp[0]) : str; } const filterNumber = (str) => { const temp = str.match(/(?=\d+)/); return temp ? str.substring(0, temp.index) : str; } const community = filterNumber(filterSpecial(filterArea(address || ''))); return community.length > 2 ? community : ''; }
大概能用,毕竟用户地址都是手填,按照一定规则的能过滤出来,不符合规则的就算了
The text was updated successfully, but these errors were encountered:
No branches or pull requests
大概能用,毕竟用户地址都是手填,按照一定规则的能过滤出来,不符合规则的就算了
The text was updated successfully, but these errors were encountered: