how to regular expression match benchmark's name if the name has "$" in it

Bo Zhang bo.zh.zhang at oracle.com
Tue Mar 7 15:48:22 UTC 2017


Hi Henri,

To clarify, by saying "accidentally", I mean I searched benchmarks from 
Github repository and apply them to analyze the performance of my 
hardware. I happened to find one repository using "$" in its name, which 
I believe is not a good idea and it indeed brought me trouble on regex 
match.

I tried

findAllIn\$chars\$100\$1k

before I  asked you. It does not work.

findAllIn.*100.*1k works.

Thanks a lot for help.

Best regards,

Bo



On 3/6/2017 8:40 PM, Henri Tremblay wrote:
> The name of the method should be the name of the method you have coded.
>
> How can you find a method "accidentally"? Are we talking about the 
> methods generated my JMH after compilation?
>
> Anyhow, those regex should match:
> findAllIn.*
> findAllIn.*100
> findAllIn\$chars\$100\$1k
>
>
> On 6 March 2017 at 15:12, Bo Zhang <bo.zh.zhang at oracle.com 
> <mailto:bo.zh.zhang at oracle.com>> wrote:
>
>     Hi there,
>
>     I am using JMH to run benchmarks. I accidentally find a benchmark
>     method, whose name is "findAllIn$chars$100$1k".
>
>     In this case, how can I use regex to match this name in my "java
>     -jar ./test/benchmark.jar  <regex match>" command?
>
>     Thanks,
>     Bo
>
>



More information about the jmh-dev mailing list