我必须使用正则表达式检查字符串license_<Two digit country code>
的国家代码_
例如license_us
或license_ca
答案 0 :(得分:0)
此代码获取select
user_id
,recommended_ids[0] as col_1
,recommended_ids[1] as col_2
,recommended_ids[2] as col_3
,recommended_ids[3] as col_4
,recommended_ids[4] as col_5
from my_table
where size(recommended_ids) >= 5 --to filter for array lengths >= 5
之后的剩余字符串:
_
打印
String key="license_us";
String country = key.substring(key.indexOf("_") + 1);
System.out.println(country);
那你为什么需要正则表达式?