Skip to main content
Solved

How to trim the first x characters of an attribute


Forum|alt.badge.img

Hi there,

the sample attribute looks like: "xxx www.mypage.com\\\\localserver.com"

Between the "xxx" (the number is variable) an the URL is a blank. So I need to find the index of the first blank and trim the attribute (string) from left to that index.

In addition I need to remove every character including an beyond "\\\\".

Any hints? I think it will work with the StringSearcher or StringReplacer...but actually I have no idea .. :-((

Thanks in advance,

Stefan

Best answer by takashi

Hi @stefangiese, the StringReplacer could also be used here, with these parameters.

  • Mode: Replace Regular Expression
  • Text To Replace: .+?\\s+(.+?)\\\\\\\\.+
  • Replacement Text: \\1
View original
Did this help you find an answer to your question?

7 replies

pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • August 3, 2017

Hi,

Attributesplitter.

You can split the value based on space


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • August 3, 2017

You could use a regular expression in a string searcher

e.g. something like (?<=\\s).+(?=\\\\\\\\) to return everything from the first space up to \\\\


Forum|alt.badge.img

Yup, worked fine... :-) Thanks...

BUT - in addition - I have a similar structure on a different attribute containing names. The attribute looks like "xxx Kindergarten Sunflower".So I need to trim "xxx " an keep the rest of the attribute. With the attribute trimmer I "cut" even the portion I want to keep. So it would be perfect to just trim the first characters incl. whitespace...


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • August 3, 2017

Hi @stefangiese, the StringReplacer could also be used here, with these parameters.

  • Mode: Replace Regular Expression
  • Text To Replace: .+?\\s+(.+?)\\\\\\\\.+
  • Replacement Text: \\1

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • August 3, 2017
takashi wrote:

Hi @stefangiese, the StringReplacer could also be used here, with these parameters.

  • Mode: Replace Regular Expression
  • Text To Replace: .+?\\s+(.+?)\\\\\\\\.+
  • Replacement Text: \\1
Updated the regex to support your new request.

 

  • Text To Replace: .+?\\s+(.+?)(\\\\\\\\.*)?$

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • August 3, 2017
stefangiese wrote:

Yup, worked fine... :-) Thanks...

BUT - in addition - I have a similar structure on a different attribute containing names. The attribute looks like "xxx Kindergarten Sunflower".So I need to trim "xxx " an keep the rest of the attribute. With the attribute trimmer I "cut" even the portion I want to keep. So it would be perfect to just trim the first characters incl. whitespace...

This will trim from the first space onwards

 

 

 


Forum|alt.badge.img

Hi takashi,

yep, works perfect!! Thanks :-)))


Reply


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