![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Capturing slices of a string Topic Summary: Created On: 17-Aug-2005 21:04 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: You can use the match function or start and end functions to extract strings that were matched by a regular expression. if (line s1) { print(s1[match 1]) print(s1[start 1: end 1] "\n") } | |
![]() |
|
I have code parses through a string and captures/identifies a substring using the Regexp construct. Portion of the code looks like the following:
------------------------------------------------------------ Object o string attrName = "Object Text" // This is the attribute to search string findMe = "Figure " Regexp line1 = regexp findMe"[0-9]+(.|-)[0-9]+\\b" string s1 - - - for o in current Module do { s1 = o.attrName "" if (line1 s1) { <some DXL code> } } -------------------------------------------------------------------------- In the "if (line1 s1)" section, I'm trying to capture anything in the s1 string that matches the regexp expression. Suggestions? |
|
![]() |
|
![]() |
|
You can use the match function or start and end functions to extract strings that were matched by a regular expression.
if (line s1) { print(s1[match 1]) print(s1[start 1: end 1] "\n") } ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Capturing slices of a string
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.