Skip to main content
Solved

How to trim the first x characters of an attribute

  • Aug 3, 2017 8:32 AM UTC
  • 7 replies
  • 1518 views

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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

pratap
Contributor
Forum|alt.badge.img+12
  • Contributor
  • Aug 3, 2017 8:35 AM UTC

Hi,

Attributesplitter.

You can split the value based on space


ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Aug 3, 2017 8:44 AM UTC

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
Celebrity
  • Best Answer
  • Aug 3, 2017 8:53 AM UTC

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

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

takashi
Celebrity
  • Aug 3, 2017 8:57 AM UTC

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
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Aug 3, 2017 9:00 AM UTC

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