I have to get each network nodes global title number range in for each loop using regex

I have to get each network nodes global title number range in for each loop using regex

If I get network global title number range in first loop like
First loop output:
91 7001
91 7001

Second loop output:
91 7002
91 7002

Please help

Please help anyone :pray:

Thanks
Shaik

just share with us the sample as text / text file

Try this c# code

// Read input text file and split into lines
string lines = File.ReadAllLines(“input.txt”);

// Process each line
var groupedOccurrences = lines
.Select(line => line.Split(’ ')) // Split each line by space
.SelectMany(parts =>
{
string nameOrNumber = parts[0]; // Get the first part (name or number)
string number = parts.Last(); // Get the last part (numeric part)
return nameOrNumber == “Network Nodes Global Title Number Range(s)” ? new { number } : Enumerable.Empty(); // Filter only numbers associated with “Network Nodes Global Title Number Range(s)”
})
.GroupBy(number => number) // Group by the numeric part
.Select(group => $“{group.Key} - occurrence {group.Count()}”); // Format output

// Write output to a DataTable
DataTable dataTable = new DataTable();
dataTable.Columns.Add(“Output”, typeof(string));

foreach (var occurrence in groupedOccurrences)
{
dataTable.Rows.Add(occurrence);
}

// Now you can use the ‘dataTable’ variable in UiPath

Sample.txt (705.5 KB)

We can use / combine different strategies:

  • Line filtering
  • Regex

For regex we can apply the divide and conquer principle:

Extract Blocks:

(?<=Network Nodes .+\n)[\s\S]+?(?=\n\D)

Extract from block:

^\d+\ \d+

can you provide sample workflow please with each loop using regex

thanks
shaik

Hi @shaik.muktharvalli1

Check the below workflow file:
Sequence58.xaml (9.4 KB)

Output:


Hope it helps!!

@Parvathy In my requirement another for each loop will run that time I have to fetch only first network nodes global title in first loop

Ex:
My another loop value TADIG code: AUTHU (Suppose this tadig contain two global titles(

My result have to get like

AUTHU 91 7019
AUTHU 91 7019

Next loop value TADIG code: AKTBY

AKTBY 91 7012
AKTBY 91 7012

Thanks
Shaik

Hi @shaik.muktharvalli1

Can you provide text file. I will help you with that.

Regards

Sample.txt (47.3 KB)

Output Like:

image

Thanks
Shaik

Hi,

Can you try the following sample?

Sample
Sample20240312-3.zip (13.6 KB)

Regards,

1 Like

Thank you sooo much @Yoichi its working fine :slightly_smiling_face:

Can you give title with below numbers in string variable with regex expression

Can you share fixed string and result string?

@Yoichi If you don’t mind please run this sample text

Sample.txt (37.5 KB)

result printed wrongly…there Two tadigs but only one tadig feed in excel

please can you try

thanks
shaik

Instead of Section ID can you take other one in regular expression

@Yoichi can you explain why you take Section ID in regular expression

Hi,

I thought SectionId is a proper unit to seprate the text.
If it’s no proper, can you share proper one.

Regards,

@Yoichi Can you try this sample text

Sample.txt (37.5 KB)

Can you get Network name with regex

am trying but not write in excel please help
Sample (1).txt (19.9 KB)