【发布时间】:2012-05-26 15:36:40
【问题描述】:
maya ascii 文件包含如下指令行。
...
createNode transform -n "pCylinder1";
createNode mesh -n "pCylinderShape1" -p "pCylinder1";
setAttr ".vif" yes;
setAttr ".uvst[0].uvsn" -type "string" "map1";
createNode transform -n "pPlane1";
setAttr ".t" -type "double3" 7.3666236108700112 0 -4.2288466031573595 ;
createNode mesh -n "pPlaneShape1" -p "pPlane1";
setAttr ".uvst[0].uvsn" -type "string" "map1";
setAttr ".cuvs" -type "string" "map1";
createNode transform -n "pTorus1";
setAttr ".t" -type "double3" -0.47688973199150198 0 -10.843417358550912 ;
...
connectAttr "polySphere1.out" "pSphereShape1.i";
connectAttr "polyCube1.out" "pCubeShape1.i";
connectAttr "polyCylinder1.out" "pCylinderShape1.i";
connectAttr "polyPlane1.out" "pPlaneShape1.i";
connectAttr "polyTorus1.out" "pTorusShape1.i";
...
在这些行中,我需要搜索一个看起来像任何行的行 以下几行。
createNode transform -n nodeName -p "FG";
createNode transform -n nodeName -p "BG";
createNode transform -n nodeName -p "MG";
我应该使用什么正则表达式来查找上述任何内容。
【问题讨论】:
-
你需要在这个问题上付出更多的努力。现在几乎无法理解。
-
好的。我需要将搜索结果(可能是 FG|BG|MG )与已知字符串连接起来。得到它,现在我需要搜索这个字符串。在上面的例子中 line2 是已知的。 zam 是未知的,即。行可以包含 FG、BG 或 MG。 say line = "createNode transform -n \"water\" -p \"FG\";"
-
尝试显示示例输入和相应的预期输出。
-
line = "createNode 变换 -n \"water\" -p \"FG\";"