Write cell the regex output

I assigned amount variable to regex System.Text.RegularExpressions.Regex.Match(group, “(-?[\d,.]+)”) and the data type is Match

Now I want to write cell the ouput from amount regex but I got error
Write Cell: Object reference not set to an instance of an object.

Any idea ? Thank you.

Hi @AhmedKutraphali ,

Data type should be Boolean I guess.

Is match gives boolean as output.
use Matches which gives collection of match items, and this can be processed through indexing

the ouput of the match is not boolean since its Match , the ouput is a number based on the pattern

What you are using for regex ?

to filter a data and the output of that data is the amount and then I write the amount value to a cell

I already tried maches and get amount(0).ToString and write that to cell still the same error

use .value with match, it will work


you mean amount(0).value ?

nope, just amount.value

value is not a member of system.regularexpression.matchcollection


Understand it this way.

  1. Assign
    amount is of type


amount=System.Text.RegularExpressions.Regex.Match(group, “(-?[\d,.]+)”)
2. use message box and type amount.value

same error when we write it to cell Write Cell: Object reference not set to an instance of an object.

What is your group value ?, probably it is returning a blank value.

its not , I can see it on a log message.

change your grup with this text “fs34234” and see result

this is the sample output

What value does your group have ? I tried with sample text and it is working perfecr

@AhmedKutraphali - please post the input text first …if your regex is not correct then you will get this error …

Also regex.match will only fetch the first match …if you have multiple matches then you have to use regex.matches. …