Getting Particular value from String

How to get JUN-20 from this string "01-JUN-20_30-JUN-20 " ?

@deepak_raj

There are multiple ways of doing this:

  1. Split String
    1.1 By _ to split into two dates
    1.2 By - to split into portions
  2. Regex (this would most likely be the better solution)

HI @deepak, So your expected result is only JUN-20 its dymanic or static one, because I am seeing 2 recored JUN-20, so how you want the result.

Regards,
Arivu

Hi @deepak_raj,

The below regex can be used to extract the data

.*-([A-z]{3}-[0-9]{2})_

but the month should be in 3 characters and the year should be 2 characters, but can be modified according to the need.

Happy coding! :slight_smile:

1 Like

Hi @deepak_raj

This can be achieve by 2 ways.

1st Way by using Regex :-

image

regexOutputVariable(0).Groups(1)

image

2nd Way by String Manipulation :-

str.Split("-“c)(3)+”-"+str.Split("-"c)(4)

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer: