Grasshopper

algorithmic modeling for Rhino

Hi,guys.Is there any way to filter a special string group from a list of string?

for example,I have already filter the number manually.And now I need to all inputed string though the Match Text componet to be true.Actuatlly I need the string have "???x???".

In this case,I have no idea the contents and string length before "???x???".but I guess its lenght will be less than 10.But when I type "?"x10 &"???x???"as pattern.It just find the {"?"x10 & "???x???"} groups.Also I try "#" as numberial placeholder,it fail.Please help.

Views: 8781

Replies to This Discussion

You could use the [Split String] with a space (" ") to split the strings apart into the prefix and suffix. Then use Split again this time wit "x" to get the numbers.

Patterns use the VB Like operator which supports:

  • ? (any single character)
  • * (any number of characters)
  • # (any single digit)
  • [ ] (any one of a group of characters)
  • [! ] (any one not in a group of characters)
  • [ - ] (any one in a range of characters)
  • [! - ] (any one not in a range of characters)

Regular Expressions are much more powerful but you'll have to read up on those yourself if you want to use them.

--

David Rutten

david@mcneel.com

Tirol, Austria

I need the data who has "???x???".

Thanks Daivd.It's easy to split out the number for use.But the question is how I found the string has such number combination.I think the question is filter string datalist which has "???x???".sorry for my bad description.I post a new pic below~

Ah, that should read

space and "()x"

--

David Rutten

david@mcneel.com

Tirol, Austria

Thanks for remind the key of departing such data.But my question is in the left side of picture,not right. ~

Try this. Its not Bomb proof as if a line of "random" values has an x in it will pick that line too.

 

OK,guys,the disturbed string may have any letter included "x",This just a sample,the solution should be use in any case.so,from my problem,the only judgement thing is the data has such format of data (000#&"x"&000#) ~anyway,thanks a lot~

 Hi channelfei, if you use Matt's definition, and put

\dx\d

in the RegEx (R) input, I think that's what you're after.  

I think this works:

--

David Rutten

david@mcneel.com

Tirol, Austria

:) Hi David - I thought channelfei's goal was to filter all complete strings that contain numberxnumber , like in the attached definition.

Attachments:

Thanks a lot.It work pretty well.And I was thinking your inputed regex "/d/dx".

Thanks.Pieter Segeren was completely solved my question.I think your solution was limited by its string format before #x#. There some data simply as "300x600"or "abc 300x500".

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service