Regex Question (Java Question)

Discussion in 'Plugin Development' started by AoH_Ruthless, Apr 18, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    AoH_Ruthless

    For my plugin, I am trying to add economy support via config. So, this is what I have so far:

    Code:java
    1. String str = ""; // It's not actually this, I just kept it short and sweet because it doesnt matter
    2. if (str.matches("\\$([1-9]\\d*)") {
    3. // CODE
    4. }


    You'll notice I have the '$' sign, but I want the money identifier to be configurable. So is it possible to do:

    Code:java
    1. String str = "";
    2. if (str.matches("\\" + getConfig().getString("Money-Tag") + "([1-9]\\d*)") {
    3. // CODE
    4. }


    I haven't really done much of regex patterns in a while, but I am sure the above works. If it doesn't, what approach can I take?
     
  2. Offline

    rohan576

    Why don't you like... you know... test it? But in all seriousness, what you have posted should work correctly.
     
Thread Status:
Not open for further replies.

Share This Page