我需要检查右侧的所有“ B”和左侧的所有“ A”。无论“#”的位置如何,只要所有“ B”都在一侧而“ A”在另一侧。例如:
Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: offer_list_rand for class: Script30
javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: offer_list_rand for class: Script30
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:324) ~[groovy-all-2.4.15.jar:2.4.15]
at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72) ~[groovy-all-2.4.15.jar:2.4.15]
at javax.script.CompiledScript.eval(CompiledScript.java:92) ~[?:1.8.0_65]
at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:221) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:71) [ApacheJMeter_java.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.0 r1840935]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]
Caused by: groovy.lang.MissingPropertyException: No such property: offer_list_rand for class: Script30
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) ~[groovy-all-2.4.15.jar:2.4.15]
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) ~[groovy-all-2.4.15.jar:2.4.15]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310) ~[groovy-all-2.4.15.jar:2.4.15]
at Script30.run(Script30.groovy:1) ~[?:?]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:321) ~[groovy-all-2.4.15.jar:2.4.15]
... 9 more
有人可以帮助我....我已经尝试过,但是我不能 谢谢
代码:
-Correct-
BBAA#
BBA#A
BBBB#AAAA
B#BBAAA
#BBAA
-Incorrect-
AAA#BBB
AAB#ABB
B#AAB
BAA#B
#ABAB
BABA#
ABBB#AA
答案 0 :(得分:-2)
正则表达式不会为您移动文本,它只会告诉您模式是否正确。您将需要除正则表达式外的另一个工具。
编辑:此正则表达式适合您。它匹配0个或多个#s,然后是零个或多个Bs 0个或更多次,然后是0个或多个#s,然后是0个或多个As 0个或更多次。 ^和$表示字符串的开头和结尾。
^(#*B*)*(#*A*)*$