How to fetch Specific numerical Content Value In API Content response

Hello Everyone

I had requirement where i need to store the umbers after GINAAPS- 123456 But sometimes they will come like this GINAAPS- 123456.docx which I need to ignore them And these (123456) numbers will Change.And numbers will come with other content they may be at begging or middle of passage or end.

Hi @mettudp075

use the regex expression and extract the numbers only

or else

assign the below syntax to a variable

System.Text.RegularExpressions.Regex.Matches(Your Variable here,"\d+")

Regards

Hi @mettudp075

Try this

\d+

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“(\d+)”)

image

I hope it helps!!

Hi @mettudp075

Use this below syntax:

input= “GINAAPS- 123456.docx”
input.Split(".“c)(0).Split(” "c)(1)

Hope it helps!!
Regards

I need to consider only the values which does not contain.docx and it is Jira comments response
We will get like: The important Ginaaps-23456 …
Matter will Differ.

@mettudp075

Try this so that it will only consider this data GINAAPS- 123456 and that too it will take only numbers from that and also it will neglect this type of data GINAAPS- 123456.docx.

or else try this by assign the expression to a variable

System.Text.RegularExpressions.Regex.Matches(Your Variable here,"\d+$")

Regards

If Ginapps-123456.png or.docx then i should ignore the item go to next item.

We will get of list of numbers and extensions

Like: Reference number for Jira Ginapps-123456 ghjkjgtyujj (some random text we will get)

Before Ginapps And Ginapps text will change.

@mettudp075

The code I mentioned above will work for only the data which ends with number

example: Ginapps-123456

The number will change And
Input we will get like: The robot value Ginapps-34567 confirm something.

@mettudp075

Is it extracted the required data?

Regards

@mettudp075 Then use the data manipulation methods by using this expression you can extract

- Assign -> TextVariable = "The robot value Ginapps-34567 confirm something."
- Assign -> TextVariable = TextVariable.Split("-")(1).Split(" ")(0).Trim.ToString

Hope it helps!!

@mettudp075

Try this

or

@mettudp075

A generic one for the same…which will handle any number that comes after hypen and also will ignore if it is continued with extension

System.Text.RegularExpressions.Regex.Match(str,"(?<=-\s*)\d+(?![\d\.])").Value

Here str is the required input string

Hope this helps

Also this looks like a possible duplicate for this post…please try avoiding duplicate posts ao that you can get answer in one place

Cheers