Forum Discussion
How do I extract a specific text with a specific text length?
- Anonymous2 years ago
I am right that you are a beginner with MCode!?
Don't thouch the "x" in this code:
= let x = Text.Select([Cross hire for Contract], {"0".."9"}) in if Text.Length(x)=5 then x else nullAndreas.
Even easier, just append a space to your text column, And then no matter where you're five digits are, you can use Text.BetweenDelimiters with "Cross Hire for Contract" and " " as your delimiters.
--Nate
- dufoq32 years agoCommunity Champion
Of course he can do it this way, but it will not extract numbers in case there is a missing space in text like "Cross hire for contract25698"
- Anonymous2 years agoNot applicable
True, but the could first use the replace values function from the GUI to replace "contract" with "contract ", and since that might cause double spaces, use the replace values function to replace " " with " ". Now you can use Text.BetweenDelimiters with "Cross Hire for Contract " and " " as your delimiters.
--Nate