Question

I need output text matching this criteria [y]["]{1}[:]{1}["]{1}[A-Z][a-z]+["]

  • 22 February 2022
  • 7 replies
  • 30 views

Badge +3

Full text is follows.....

{"region":"New York, NY","currentConditions":{"dayhour":"Sunday 10:00 AM","temp":{"c":-3,"f":27},"precip":"0%","humidity":"45%","wind":{"km":10,"mile":6},"iconURL":"https://ssl.gstatic.com/onebox/weather/64/partly_cloudy.pngquot;,"comment":"Mostly sunny"},"next_days":[{"day":"Sunday","comment":"Mostly sunny","max_temp":{"c":4,"f":40},"min_temp":{"c":-3,"f":27},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/partly_cloudy.pngquot;},{"day":"Monday","comment":"Sunny","max_temp":{"c":12,"f":54},"min_temp":{"c":5,"f":41},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/sunny.pngquot;},{"day":"Tuesday","comment":"Rain","max_temp":{"c":13,"f":56},"min_temp":{"c":12,"f":53},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/rain.pngquot;},{"day":"Wednesday","comment":"Scattered showers","max_temp":{"c":18,"f":65},"min_temp":{"c":1,"f":34},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/rain_s_cloudy.pngquot;},{"day":"Thursday","comment":"Cloudy","max_temp":{"c":4,"f":39},"min_temp":{"c":2,"f":36},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/cloudy.pngquot;},{"day":"Friday","comment":"Rain","max_temp":{"c":6,"f":43},"min_temp":{"c":-3,"f":26},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/rain.pngquot;},{"day":"Saturday","comment":"Mostly sunny","max_temp":{"c":2,"f":35},"min_temp":{"c":-2,"f":28},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/partly_cloudy.pngquot;},{"day":"Sunday","comment":"Partly cloudy","max_temp":{"c":5,"f":41},"min_temp":{"c":-1,"f":31},"iconURL":"https://ssl.gstatic.com/onebox/weather/48/partly_cloudy.pngquot;}],"contact_author":{"email":"communication.with.users@gmail.com","auth_note":"Mail me for feature requests, improvement, bug, help, ect... Please tell me if you want me to provide any other free easy-to-use API services"},"data_source":"https://www.google.com/search?lr=lang_enamp;q=weather+in+newyork"}


7 replies

Any help @Ashwin A.K​ @ChanduMohammad S​ 

 

Basically trying to retrieve the list of days from the block of text using Regex instead of String Operations. For ex, Sunday, Monday...etc.

Userlevel 4
Badge +7

Hi @LAXMAN Ch,

 

Is this the sort of selection you were looking for?

 

RegexMatchIf so, then use the REGEX TOOLS package(Extract All Matches) and pass this pattern in:

(?<=\"day\"\:\").*?(?=\")

 

Kind Regards,

Ashwin A.K​ 

R3Works brilliantly, thank you @Ashwin A.K​!

 

Follow up question: regexr.com sure gives the correct results but when the same is applied within the bot (string operations > replace) it returns the exact inverse. What did I miss?

 

R1R2 

Tried the same using the REGEX tools like you suggested and saw this. Confused 🙄

R4R5

Userlevel 4
Badge +7

Hi @A Aravinth​ ,

 

The String:Replace Action will replace all instances of the match, which is why I suggested to use the REGEX TOOL: Extract All Matches Action.

 

OutputDaysRegexMatches 

That action outputs a List of Dictionaries, which is why you can't simply display it in a message box.

Actually you can, but that is too much complication, so try this instead:

Assign the output variable from the Regex Action into a Loop: For Each Item in List:

 

image 

Declare a dictionary variable, pass that into the field shown below:

 

image 

Then reference the "match" key and you are good to go.

 

imageKind Regards,

Ashwin A.K

 

Badge +3

Thank you Ashwin. RegEx Tool worked excellent for exact matches.

Thank you Arvind

thanks &regards

Laxman Ch

Userlevel 4
Badge +7

Glad we could help!

 

I'd appreciate it if you could mark the solution as "Best" so that others facing similar issues may benefit from it as well, and so that we can close this thread.

 

Kind Regards,

Ashwin A.K

Reply