Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gets the content between two tags
#5
Thanks, works Well,

The following logic seems easier to understand, 
Is it possible to create a member function(_s.Match) like -match?

---------------------------------------------------
$between = $false
$s |
foreach{
        if ($_ -match '#if.+|#endif')
        {
                $between = !$between
        }
        else
        {
                if ($between -eq $true) { $_ }
        }
}

1.Deleting them(#if...#endif) using the following regular expression leaves an extra blank line

2.What does (?s) mean?
-------------------------------------------------
_s.replacerx("#if.*(?s).*?#endif" "")

3. When there are multiple lines of content, trim has no effect
out a2[1 i].trim
-------------------------------------------------
 #if A
     part1
     part1

 #endif
 
 part
 part
 
 #if V
     part2
     part2
     part2

 #endif
 
 part
 part
 
 #if C
     part3
     part3

 #endif


Messages In This Thread
Gets the content between two tags - by Davider - 10-28-2022, 03:38 AM
RE: Gets the content between two tags - by Kevin - 10-28-2022, 12:42 PM
RE: Gets the content between two tags - by Kevin - 10-28-2022, 07:49 PM
RE: Gets the content between two tags - by Davider - 10-28-2022, 10:52 PM
RE: Gets the content between two tags - by Kevin - 11-02-2022, 01:49 PM
RE: Gets the content between two tags - by Kevin - 11-03-2022, 04:19 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)