小编jm *_* li的帖子

如何使用正则表达式来验证中文输入?

问题是我需要在客户端验证中将此类中文输入视为无效:

任何与任何中文字符和空格混合的英文字符总长度> = 10时,输入无效.

让我们说:"你的是你的你的你"或"你的你的你的你"(长度为10)无效.但是"你的是你的一个人"(长度为9)是可以的.

我使用Javascript进行客户端验证,使用Java进行服务器端.所以我认为在两者上应用正则表达式应该是完美的.

任何人都可以提供一些提示如何在正则表达式中编写规则?

javascript regex unicode validation

4
推荐指数
1
解决办法
2326
查看次数

Spring 注解 AOP 调用两次

我使用自定义注释为我的 spring boot 控制器注释了一些功能,以用于记录目的。但是,我发现对于嵌套方法,before 建议会执行两次。在这里寻找一些想法。请参考下面的代码片段。

控制器

@RequestMapping(value = "apply")
    @OperationMILog
    public ApplyHttpResponse apply(@RequestHeader final String custId, @RequestAttribute final String cardNo,
        @RequestBody final InstallmentApplyHttpRequest installApplyReq, @PathVariable final String source) {

        //test
        this.test();  //**line 387**

...
}


 ....
     @OperationMILog
        private String test() {
            return this.test1(); //**line 593**
        }

@OperationMILog
private String test1() {
    return "test1";
}
Run Code Online (Sandbox Code Playgroud)

注释

@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface OperationMILog {

}
Run Code Online (Sandbox Code Playgroud)

方面

@Aspect
public class GenericLoggingAspect {

      public static GenericLoggingAspect genericLoggingAspect;

        @PostConstruct
        public void init() { …
Run Code Online (Sandbox Code Playgroud)

aop annotations spring-aop

4
推荐指数
1
解决办法
1432
查看次数

标签 统计

annotations ×1

aop ×1

javascript ×1

regex ×1

spring-aop ×1

unicode ×1

validation ×1