Jump to content

escape character in string replacement problem


Recommended Posts

Hi all!

I have a problem with attribstringedit to replace characters in a string. It works well with / but not with \ . Is there a workaround for this limitation ? Like doing it in Vex or using ascii code instead of the \ character ?

If anyone could help me out that would be amazing ! I`ve included a sample scene.

escapeCharacterReplace.hiplc

Link to comment
Share on other sites

Sometimes path manipulations are easier to perform using Python.

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.

import re
for p in geo.points():
    s = p.attribValue("myPath")
    result = re.sub(r"\\\\",r"/",s)
    p.setAttribValue("myPath",result)

 

Untitled-1.jpg

Edited by Atom
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...