1

If i have data that is like

DAAR BR 37291 Y%oVol <0.001
Bil2 CH 382 %Mass 0.01
JOL BR 444489 Vol 44.4
TOME BR 37291 Y%oVol <0.005

I want to capture the end value for DAAR (<0.001) but no other line using REGEX that I can put into PAD.

I know that (\s\<\d\.\d*) will capture the <0.001 but I can't find a way to apply only to DAAR.

In short, what is between DAAR and <0.001 could be anything.

Toto
  • 19,304

1 Answers1

0

Regular expressions in Power Automate are problematic. Also, while it can crop the text before the first occurrence of a space, it cannot crop the text after a last occurrence.

However, you can reverse the text, crop everything before the first space, then reverse that to get everything after the last space:

flow to crop text after last space

LOOP FOREACH CurrentItem IN FileContents
    Text.CropText.CropTextBeforeFlag Text: CurrentItem ToFlag: $'''%' '%''' IgnoreCase: False CroppedText=> CroppedText IsFlagFound=> IsFlagFound
    IF IsFlagFound = $'''true''' THEN
        IF CroppedText = $'''%'DAAR'%''' THEN
            Text.Reverse Text: CurrentItem ReversedText=> ReversedItem
            Text.CropText.CropTextBeforeFlag Text: ReversedItem ToFlag: $'''%' '%''' IgnoreCase: False CroppedText=> CroppedReversedText IsFlagFound=> IsFlagFound
            IF IsFlagFound = $'''true''' THEN
                Text.Reverse Text: CroppedReversedText ReversedText=> CroppedText
                Display.ShowMessageDialog.ShowMessage Title: $'''Cropped Text''' Message: CroppedText Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
            END
        END
    END
END

Note you will have to get the file or list into FileContents first, and you might want to output CroppedText to a file instead of displaying it.

Corvus
  • 1