#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0

    Question Simple help please. CSV element


    I can not wrap my head around this. New to Regexp and spent all day yesterday trying to capture just the 3rd ellement, 177.95 in the following text.

    Any help would be appreciated and help my Regexp learning. Thanks!

    ["ETH",1557183895,177.95,180.75,161.9,12.1,7.3,66741.97976738]
  2. #2
  3. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    If those [ ]s are actually part of the string then this is JSON, not CSV.

    If not then all you have to do is capture the second group of numeric values. Which, of course, consist of numbers and possibly a period...
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    Sorry, yes it's json. Been playing with something like this (?:[^\,]*\,){1}([^,]*\,)(?:[^\,]*\,) which catures all to the last comma but includes everything up to it.
  6. #4
  7. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    If it's JSON then use whatever programming language you have to parse it as the JSON array it actually is. No need for regular expression craziness.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    It's an android app that monitors changes to webpages that only uses Regexp scripting.
  10. #6
  11. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    Regular expressions are not scripting.

    Android? Then you should have access to either Java or Javascript. Which?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    Neither. It's an Android phone app with regex scripting built in.
  14. #8
  15. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    Again, "regex scripting" isn't a thing.

    What app?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    Web Alert.
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    You're killin me with your knowledge Bra.
  20. #11
  21. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    Like I said earlier, you only need to look for numbers. The first number in there is a timestamp and will be an integer, then a comma, then will be a number possibly followed by a period and more numbers.
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    Thank you so much for stating the obvious, again.
  24. #13
  25. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    I thought of an easier answer.

    The third group is the second group of numbers, which is another way of saying it's the first group of numbers after another group of numbers.

    "Obviously" you need to match a number. Less obvious is that you can use a positive lookbehind that ensures the group you're matching is preceded by simply a number and a comma. If won't find the string, it won't find the first number because it's preceded by a string, and it will find the second number because it's preceded by a number.
  26. #14
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2019
    Posts
    8
    Rep Power
    0
    You wouln't happen to know the string of characters to pull just that data would you?
  28. #15
  29. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,977
    Rep Power
    9647
    The lookbehind is (?<\d,) and the number portion should be straightforward.

    If it's not obvious, I'm avoiding just giving you the answer. Trying to guide you to it.

IMN logo majestic logo threadwatch logo seochat tools logo