Skip to main content
I am trying to parse out attributes from a autocad layer name for example

 

4 DR-21 PVC C-900 W and are using the following string.

 

 

^(>0-9]{1,2})\\s(\A-Z0-9]{2,3}-3A-Z0-9]{2,3})\\s(\A-Z]{2,3})\\s(\A-Z]-Z0-9]{2,3})

 

 

Attached are the transformer settings. And trying to go off of what Takashi explained in another post but no luck. It just transfer the complete 4 DR-21 PVC C-900 W to the database fields.

 

It pulls it into groups on Rubular.com but can not get them to split??? any sugestions

 

https://lh4.googleusercontent.com/-NbYXOBTklJU/UkWTEP2CK6I/AAAAAAAAAD0/uMYOFgbx5_Y/s330-o/Attribute_Renamer_Settings.JPG

 

 

https://lh4.googleusercontent.com/-5Fy6rYasiqg/UkWTEN828gI/AAAAAAAAAD0/PbN_5JwgY5g/s330-o/Attribute_Split_Settings.JPG

 

 

https://lh5.googleusercontent.com/-4LGl2OpTA14/UkWTpdHO9qI/AAAAAAAAAEA/9Q-Y_AOYnUM/s330/Rubular.JPG
Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
Takashi,

 

Thank you for your reply(and patience), I have tryied that and the output is just the full layer name? Here is how it is set up with "space" in the Delimeter or format string filed?

 

 

 

 

https://lh4.googleusercontent.com/vh_s-VMA9kPuEShEbzw6JplqeJ9YHepMyUe2rKY0jA=w440-h144
Takashi,

 

Thank you for your reply(and patience), I have tryied that and the output is just the full layer name? Here is how it is set up with "space" in the Delimeter or format string filed?

 

 

 

 

https://lh4.googleusercontent.com/vh_s-VMA9kPuEShEbzw6JplqeJ9YHepMyUe2rKY0jA=w440-h144
Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
Hi

 

Try the advanced text editor as shown here:

 

http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/attributesplitter.htm

 

 


Hi

 

Try the advanced text editor as shown here:

 

http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/attributesplitter.htm

 

 


Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
I think you can set a white space to "Delimiter or Format String" by the same way (i.e. pressing a key) as other characters such like comma, hyphen, underscore etc.. Not special, just invisible.

 

Connect a Logger after the AttributeRenamer, and run. How are the attributes logged?
I think you can set a white space to "Delimiter or Format String" by the same way (i.e. pressing a key) as other characters such like comma, hyphen, underscore etc.. Not special, just invisible.

 

Connect a Logger after the AttributeRenamer, and run. How are the attributes logged?
I believe the AttributeSplitter with parameter settings like this image would work. A white space is set to the "Delimiter or Format String", although it's invisible.

 


Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
I believe the AttributeSplitter with parameter settings like this image would work. A white space is set to the "Delimiter or Format String", although it's invisible.

 


OMG it worked!!! Thank you very much,,, Love this program but can get fustrating at times. Now to to research and learn the concatenator. Thanks again!  
Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
OMG it worked!!! Thank you very much,,, Love this program but can get fustrating at times. Now to to research and learn the concatenator. Thanks again!  
What u are doing is sending ur matched parts to 4 variables.

 

As a single space is enough to find these in this your  case, splitting by space is adequate.

 

 

Using your expression in a Stringsearcher u could have aquired your attributes bij exposing 4 elements.

 

 

If the parts would contain spaces, then it wont do of course.

 

 

Writing TLC code in the attributecreator or tester or whatever, is by far more powerfull btw.

 

Like in your case:

 

@Evaluate(@regexp  {^(e0-9]{1,2})\\s(]A-Z0-9]{2,3}-ZA-Z0-9]{2,3})\\s(]A-Z]{2,3})\\s(]A-Z]-)0-9]{2,3})} "@Value(Acad_lyr)" Matched Att1 Att2 Att3 Att4])?"tset Acad_lyrList clist $Att1 $Att2 $Att3 $Att4]]":"no such thing"

 

 

..makes a list in an attribute (when used in the attributecreator)

 

 

 


Hi,

 

 

Regular expression cannot be used as format parameter of the AttributeSplitter.

 

If you need to validate and split the string, consider using the StringSearcher transformer with the regex.

 

Just to split the string at white space, you can use the AttributeSplitter with a white space (not regex) as the delimiter.

 

Takashi
What u are doing is sending ur matched parts to 4 variables.

 

As a single space is enough to find these in this your  case, splitting by space is adequate.

 

 

Using your expression in a Stringsearcher u could have aquired your attributes bij exposing 4 elements.

 

 

If the parts would contain spaces, then it wont do of course.

 

 

Writing TLC code in the attributecreator or tester or whatever, is by far more powerfull btw.

 

Like in your case:

 

@Evaluate( regexp  {^(t0-9]{1,2})\\s((A-Z0-9]{2,3}-sA-Z0-9]{2,3})\\s(-A-Z]{2,3})\\s((A-Z]-{0-9]{2,3})} "@Value(Acad_lyr)" Matched Att1 Att2 Att3 Att4])?"tset Acad_lyrList elist $Att1 $Att2 $Att3 $Att4]]":"no such thing"

 

 

..makes a list in an attribute (when used in the attributecreator)

 

 

 


I have an issue with separator like "\\\\". I counterpast it by replacing "\\\\" with a double hashtag before Splitter.


I have an issue with separator like "\\". I counterpast it by replacing "\\" with a double hashtag before Splitter.

Hi @webservicessia, I was able to split this string

 

aaa\\bbb\\ccc
by the AttributeSplitter with these parameters.

 

Delimiter or Format String: \\
List Name: _list
Log:

 

Attribute(encoded: utf-8): `_list{0}' has value `aaa'
Attribute(encoded: utf-8): `_list{1}' has value `bbb'
Attribute(encoded: utf-8): `_list{2}' has value `ccc'
What is your problem?

mikesando

Rubular shows the resulting matches and submatches.

You can use the regexp you posted in a stringsearcher to achieve the same result.

Use allmatch and submatch (advanced part).

Then you captures are in the submatch list.

(also remember that Rubular can use 3 flavors. FME can not fully match what Rubular does. But mostly when the regexp gets complicated.)

Also

^(\\d+)\\s([\\w\\d-]+)\\s(\\w+)\\s([\\w\\d-]+) seems more elegant..though , as @takashi pointed out, the most discerning bit of the pattern are the spaces. You might as well do

(.+)\\s(.+)\\s(.+)\\s(.+) to get em in 4 capture groups.

Which shows you are splitting by space.

Splitter should work indeed, also pointed out by @takashi


That work effectively. I donot know why I did not manage to do this before. Thank you for your reply.


I have an issue with separator like "\\\\". I counterpast it by replacing "\\\\" with a double hashtag before Splitter.

That work now. I do not know why that was wrong before. Thank you for your answer.

Reply