Quantcast
Channel: Cadence Community
Viewing all articles
Browse latest Browse all 3331

Pattern matching

$
0
0

 Hello all,

I have a small query on pattern matching . Actually I am trying to search for the data in between two keywords say "REVA" and "REVB" from the userdefined input data (assumed that the keywords "REVA" , "REVB ... are always present in the input data without duplicates or repetitions) . Is there a way that I search the user defined input data  for two keywords "REVA" and "REVB" and what ever the data inbetween this two words has to be dumped in to a variable REVA , similarly whatever the data that is present in between "REVB" and "REVC" to REVB field  etc , ineffective I am seperating the respective revision data to their corresponding fields from the given input data.

May be the following ex gives more info:

;Skill starts here 

 procedure(testpattern()
inputdata = "REVA: This Text belongs to revision A \n REVB: This Text belongs \n to revision B. REVC: This \n Text belongs to revision C"
input = hiCreateMLTextField(?name 'input ?prompt "INPUT" ?value inputdata  ?hasVerticalScrollbar nil ?hasHorizontalScrollbar nil)
REVA = hiCreateMLTextField(?name 'REVA ?prompt "REVA" ?value ""  ?hasVerticalScrollbar nil ?hasHorizontalScrollbar nil)
REVB = hiCreateMLTextField(?name 'REVB ?prompt "REVB" ?value ""  ?hasVerticalScrollbar nil ?hasHorizontalScrollbar nil)
REVC = hiCreateMLTextField(?name 'REVC ?prompt "REVC" ?value ""  ?hasVerticalScrollbar nil ?hasHorizontalScrollbar nil)
fillform=hiCreateButton(?name 'fillform ?buttonText "Fill Form" ?callback "fillform()")
testform = hiCreateAppForm(
     ?name 'testform
     ?formTitle "Pattern Matching"
     ?fields list(
                    list(input  15:15  400:70 50)
                    list(REVA  15:100  400:20 50)
                    list(REVB  15:150  400:20 50)
                    list(REVC  15:200  400:20 50)
                    list(fillform  15:260  100:30 50))

?initialSize t
)
hiDisplayForm(testform)
)

 ; ends here 

 

Now what I require is the fillform() function must put the data say " This Text belongs to revision A" in to REVA field by searching the input data. Similarly for other fields "REVB" "REVC".

I have tried using rexMatchp() and other pattern matching functions but the return value is always a t or nil but not the data.

Is there a way to achieve this.

Thank you very much in advance for your time.

 

Best regards,

Sri. 


Viewing all articles
Browse latest Browse all 3331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>