Yaml Parser窒息

时间:2009-07-15 18:52:25

标签: java regex parsing selenium yaml

我有一个yaml片段

...
passwordregexp: '.{8},[0-9],[^0-9A-Za-z ],[A-Z],[a-z]'
passwordregexpfailmessage: |-
    Contain at least 8 characters
    Contain at least 1 Number
    Contain at least  1 Special Character
    Contain at least 1 Upper Case Letter
    Contain at least 1 Lower Case Letter
passwordresetperiod: 1000
pdflatex_path: /usr/local/texlive/bin/x86_64-linux/pdflatex
...

我的yaml解析器在Passwordregexfailmessage上窒息: 很明显它不喜欢语法,但我不熟悉yaml。如何引用或构造此元素以使其可解析。

如果密码不符合passwordregexp标准,则会显示此信息。

1 个答案:

答案 0 :(得分:0)

该文件有效YAML 1.1

%YAML 1.1
---
!!map {
    ? !!str "passwordregexp"
    : !!str ".{8},[0-9],[^0-9A-Za-z ],[A-Z],[a-z]",
    ? !!str "passwordregexpfailmessage"
    : !!str "Contain at least 8 characters\nContain at least 1 Number\nContain at\
        \ least  1 Special Character\nContain at least 1 Upper Case Letter\nContain\
        \ at least 1 Lower Case Letter",
    ? !!str "passwordresetperiod"
    : !!int "1000",
    ? !!str "pdflatex_path"
    : !!str "/usr/local/texlive/bin/x86_64-linux/pdflatex",
}
...

什么是解析器?它是否支持YAML 1.1?