How to split the given text from a website

In a project I am doing, I need to pull the text of a name. When I use “get text” activity, for example it provides this: “2/20/2022 2:05:11 PM5 seconds agoLong Keys Bike Club” All I want is “Long Keys Bike Club”. How would I split the string to only provide this name?

Hey @RPALearner_17 ! Try this!

System.Text.RegularExpressions.Regex.Match( "2/20/2022 2:05:11 PM5 seconds agoLong Keys Bike Club","(?<=ago)[\s\S]*").ToString

Hope it helps!

That worked thank you!! I have another question, so it refreshes and will be a new date, time, duration of post, and property name. How could I possibly split that?

Great!!! Regardless of date, time, duration of post, and property name this regex will always get what is after the String “ago”. If you always have that rule, you’ll get it.

So i tried again today, with my sequence and it says “unrecognized escape sequence”

to add more context, I pull from the site using “Get Text” I set the text to be variable propname. To use the “propname” of whichever property name appears, how would I utilize that in the code?

I guess you are using a C# project instead VB project

am I able to switch over to VB easily?

Only for Studio Pro version

Use the following steps to convert your project from “C#” to “VB.Net

  • Open the “project.json” file in your preferred code editor (I used Notepad++)
  • Scroll down until you find “expressionLanguage”: “CSharp”,
  • Change “expressionLanguage”: “CSharp”, to “expressionLanguage”: “VisualBasic”,
  • Re-launch your project and continue with VisualBasic Legacy

Reference: Convert C# to VB.NET - #2 by andrew_Rogers

If you don’t have the PRO version of Studio, create a new project.

It works! thank you!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.