How i can apply mandatory condition in Regex

I want to search PO:6767676767 where starting string can be anything for ex.Po. number,Po NO.,Order No.

I am trying this regex

But it also searches for “9898786767”(which is 10 digit no) which i don’t want.

I want that string which starts with PO,PO No.

@pooja3 Hi,
You can simple OR operator in your regex to implement the same.

where to use or operator?.
The above given regex is giving me only 10 digit number.(i want to handle)

can you send the text for which you are trying to match.

I trying for

1.Po No:9087675656
2.Po Number:9556565655
3.Order No:0956453423
4.Order Number:9076554556
5.Purchase order Number:9078675656.

Ok fine , in these which all lines you wanna match?

I have not shared you the entire string.
The above are the matches which i need to search within every string.
any of the above matches will be present in the entire string.

try this regex:
((Po No:)|(Po Number:)|(Order No:)|(Order Number:)|(Purchase order Number:))(\d+)

Ok I will try this


1 Like

Can we make it more specific like
if space occur in between like

Po No :8787878787
Po No: 8787878787
Purchase Order Number : 8767564545
space can be anywhere.

Even .(dot) can be occur like
Po No.:8976767676
Po. No : 8787878787

@pooja3 Hi,
try this
(Po(.)? No:(\s)?\d*)|(Po(.)? Number:(\s)?\d*)|(Order No(.)?:(\s)?\d*)|(Order Number:(\s)?\d*)|(Purchase order Number:(\s)?\d*.)

Not working for “PO.No.: 7878787878”