|
@@ -21,7 +21,7 @@ trait BaseFunc {
|
|
@(transient@getter) protected val spark: SparkSession
|
|
@(transient@getter) protected val spark: SparkSession
|
|
private val pattern = "[^\\u4e00-\\u9fa5a-zA-Z \\(\\)().]+".r
|
|
private val pattern = "[^\\u4e00-\\u9fa5a-zA-Z \\(\\)().]+".r
|
|
|
|
|
|
- private val id_card_pattern = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2])|\\*{2})(([0-2][1-9])|10|20|30|31|\\*{2})\\d{3}[0-9Xx]$".r
|
|
|
|
|
|
+ private val id_card_pattern = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2])|([0-1]\\*{1,2})|\\*{2})(([0-2][1-9])|10|20|30|31|\\*{2})\\d{3}[0-9Xx]$".r
|
|
|
|
|
|
|
|
|
|
/* def to_epoch_millis_timestamp(): Unit = {
|
|
/* def to_epoch_millis_timestamp(): Unit = {
|
|
@@ -34,6 +34,10 @@ trait BaseFunc {
|
|
spark.udf.register("case_no_trim", case_no_trim _)
|
|
spark.udf.register("case_no_trim", case_no_trim _)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ def id_card_trim_udf(): Unit = {
|
|
|
|
+ spark.udf.register("id_card_trim", id_card_trim _)
|
|
|
|
+ }
|
|
|
|
+
|
|
def is_id_card(): Unit = {
|
|
def is_id_card(): Unit = {
|
|
spark.udf.register("is_id_card", (str: String) => id_card_pattern matches str)
|
|
spark.udf.register("is_id_card", (str: String) => id_card_pattern matches str)
|
|
}
|
|
}
|