Skip to main content
Solved

Wildcard to find string in StringReplacer or BulkAttributeRenamer

  • September 22, 2016
  • 5 replies
  • 155 views

ngstoke
Contributor
Forum|alt.badge.img+1

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.

Best answer by taojunabc

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.)

View original
Did this help you find an answer to your question?

5 replies

taojunabc
Participant
Forum|alt.badge.img+6
  • Participant
  • Best Answer
  • September 22, 2016

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.)


ngstoke
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 22, 2016
taojunabc wrote:

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:

 

 

 


ngstoke
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 22, 2016
taojunabc wrote:

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

 

 


taojunabc
Participant
Forum|alt.badge.img+6
  • Participant
  • September 22, 2016
ngstoke wrote:
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/

 

 


ngstoke
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 22, 2016

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings