Skip to main content

I have an attribute field "Current Operator" that I am trying to find certain operators and rename.

I've tried StringReplacer and BulkAttributeRenamer but can't seem to get the expression right.

Ideally I'd like find all names that match certain operators, for example:

"Carrizo" without having to input ("Carrizo O&G;", "Carrizo Oil and Gas" ,etc)

"Hilcorp" without having to input ("Hilcorp O&G;", etc)

"Marathon without having to input ("Marathon O&G;", "Marathon Oil & Gas" etc)

Is there a wildcard to catch all the words after?

Also do I have to create a separate transformer for every attribute I want to rename (Hilcorp, Carrizo, Marathon)?

I have a much larger list and would like to input all the names in one transformer and rename them all at once to their respected values.

If you want to use only one Transformer, you can use StringReplacer, and using regular
expressions. I use Japanese windows7, If you use other language os, You can replace ?? to \\1.

The regular expression matching with CARRIZO, HILCORP or MARATHON at the
beginning of an arbitrary string, will they use parentheses that can be
identified as a group, \\ 1 be matched the first group (in the above regular
expression, one and only one group.)


If you want to use only one Transformer, you can use StringReplacer, and using regular
expressions. I use Japanese windows7, If you use other language os, You can replace ?? to \\1.

The regular expression matching with CARRIZO, HILCORP or MARATHON at the
beginning of an arbitrary string, will they use parentheses that can be
identified as a group, \\ 1 be matched the first group (in the above regular
expression, one and only one group.)

output.jpg

Hi taojunabc. Thank you for the quick reply.

 

It's hard for me to make out the charaters completely.

 

 

What is the first character before (CARRIZO|) is it an asterisk (*)?

 

Are the last to characters a period (.) and another asterisk (*)?

 

For Replacement Text is it ¥ and a | or a 1 ?

 

 

This what I'm getting as an output:

 

 

 


If you want to use only one Transformer, you can use StringReplacer, and using regular
expressions. I use Japanese windows7, If you use other language os, You can replace ?? to \\1.

The regular expression matching with CARRIZO, HILCORP or MARATHON at the
beginning of an arbitrary string, will they use parentheses that can be
identified as a group, \\ 1 be matched the first group (in the above regular
expression, one and only one group.)

stringreplacer.jpg

 

 


stringreplacer.jpg

 

 

What is the first character before (CARRIZO|) is it an asterisk (*)?It's a ^.

 

 

The whole regular expressions is

 

^(CARRIZO|HILCORP|MARATHON).*

 

 

Replacement Text is \\1 (The number 1 )

 

 

About more Regular Expressions. You can reference https://regexone.com/

 

 


Thank you taojunabc, that worked. I appreciate the clarification and the addition resources.


Reply