Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Level I

unable to use regex function to compare to variable

Hi all , i facing a problem to compare to string inside a variable. This works well when i dont use varialbe , can somemore please help ? The result is always "." even though it one string is a substring of another.  


If( regex(char(stepproduct),char(step),"1")=="1",
				stepproduct = Substitute( Char( stepproduct ), step, "" );
				tableExist = 1;
				tableExist = 0;

Re: unable to use regex function to compare to variable

It would help if you could show a few rows of the data table or give examples of values for stepproduct and step. What are the values of these values prior to calling the If() function? Also, are they both numbers?


Do you mean the result of the Regex() function, the Substitute() function, or the If() function is missing?


This case is simple and will certainly work with the correct regular expression, it might be easier to use the Contains() function.

Learn it once, use it forever!
Article Labels

    There are no labels assigned to this post.