Part Replace multiple words using Regex -


I want to process a lot of files as part of post migration of my code. The Migration Tool can handle Regx and we write something like the following:
'Change #' Column (",". Column ("
Replace All All Events") column ("with". Item ("."

One of our requirements as I tap string word I.e. I want to replace it with double quotation marks i.e. "optional" for example, byVal strID2 should be string = nullstraking
string - as the optional ByVal strID2 = ""

As NullString in VB6 is now going to be a square variable and in the function declaration it should be a constant.
So, I need RegEx with one of the following criteria:

  1. Make sure that in the function declaration it means "function" whose name is "bracket" and "cell" , Then any event of [= NullString] should be replaced with [= ""] until we hit the closing bracket) ", as the declaration may be on multiple lines. / Li>
  2. Just see that its optional parameters. Match the word "alternate" and then replace "Like string = NullString" and NullString with "".

I can use one of 2 as a criterion but I'm unable to write a RegEx below, I have a sample file and I have explained what I want for each line.


My Ramp File Content

Line 1 : Public Ceremony GetAllAddresses (ByVal lngObjectType string, as ByVal strID1 string, as optional ByVal strID2 string = NullString, as optional ByVal strID3 string = NullString, Optional ByVal blnExtraAddresses as Boolean form = false, optional ByRef objDataRequest CDataRequest = Nothing) as in ADORecordset
line 2 : string as a dot
Line 3 : s = NullString
line 4 ( Empty):
Line 5 : Public function getDefaultPaymentAddress (ByVal lngObjectType integer, ByVal strID1 string, ByVal as strID2 string, optional ByRef ObjDataRequest CDataRequest = nothing as in the form of typAddress
line 6 : public function myfunc (optional ByVal strID2 = string = NullStr, _
line 7 : & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; ; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; Optional ByVal strID3 as string = NullString, _
line 8 : & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; Boolean = false, _
line 9 as optional ByVal blnExtraAddresses: & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; ; Optional ByRef objDataRequest form CDataRequest = nothing) as a string
Line 10 : with some code Comment = NullString


Expected Output strong> For each line:

  1. Line 1 : Being a large line, replace the full declaration with NullString with quotation marks by ""
  2. line 2 : As
  3. line 3 : As < notice that the nullustring should not be done
  4. Line 4 : As if it is empty
  5. line 5 : As it is.
  6. Line 6 to 9 : 2 tap string has been replaced by double quote (line 6 and 7)
  7. Line 10 : As it is. This is just a comment - I can have something like if myVar = NullString , but it should not be matched and changed. Thanks in advance for help.
    Regards, Nick

All changes made with a regex possible is not.

You can try the following:

  'Repeat this until, unless there are any more changes, search: (function + \ w + * \ ([^) ] *)? \ BNullString \ b: Replace $ 1 "" 'Use this multiline match for this one: ^ ([\ t] * \ w + * = *) NullString \ b Replace: $ 1 ""  

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -