cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is the Regex to omit words with sequence of uppercase letters from a group of sentences.?

srimathi_srini1
Contributor

For example...if I have a sentence as below as input:.
The details you entered is same as already given for MISS XXX. Kindly change the details for MISS YYY.
my expected output should be like

The details you entered is same as already given for.Kindly change the details for.
Can someone kindly help me on this.?


8 REPLIES 8

Radu
Dynatrace Pro
Dynatrace Pro

Hi Srimanthi,

You can use multiple capture groups. So you can use something like:

(The details you entered is same as already given for )[A-Z]+\ [A-Z]+(\. Kindly change the details for )[A-Z]+\ [A-Z]+\.

And that will capture what you need, leaving out the stuff in capital letters.

Let me know how that goes.

Best regards,

Radu


Hi Radu,
Thanks for ur reply.
Actually I have set the BT to capture N number of errors.
I have mentioned only one of those errors above.So if I specifically write a regex for that error alone..the other errors are not being captured.
I need a generic regex which will capture all the errors and in case of the above error it should not consider the name part (ie MISS XXX ,etc)and the name may be longer than 2 words also.
Can you help me on this?


This may take a while 🙂

try:

(.*?)[A-Z]+\ ?(.*?)

do you have a couple of purepaths with these errors that you can attach here? It would be easier to test these out directly on some input.


I am attaching the screenshot of my BT output below


rishabh_yadav1
Inactive

Hi @Srimathi S.

Can you please attach some samples for the errors/exceptions so that I can have a clear picture as what possible conditions will match with the errors while designing the regex.

Cause designing regex without knowing the possible senarios we dealing with is going to be tricky.

Thanks and Regards,

Rishabh

+91-8090500238

Linkedin


I am attaching the screenshot of my BT output below


srimathi_srini1
Contributor

Hi @Radu S, @Rishabh Y.
I am attaching the screenshot of my BT output.
It is a user action based BT.
The scenario is I am capturing all the errors in a certain application.one of those errors have name of the customer mentioned in it.Due to this I am getting seperate entries for same error. I want that particular error to be grouped. I can see that only the name is different..the other parts are same and that the names are in capital letters. So I wanted a common regex which would accept all errors but should group this particular with name together.test.png


rswarnka
Helper

Hi, Try this:

(The details you entered is same as already given for).\*?(Kindly change the details for).\*?|.\*?(Unknown Error).\*|(There is a problem with the).\*?(have entered\. Please verify this and resubmit your details\.)