syntax:pe

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
syntax:pe [2021/12/10 08:11]
ajrou [From the end]
syntax:pe [2021/12/10 08:12]
ajrou [From the beginning]
Line 238: Line 238:
 The operator "''#''"​ will try to remove the shortest text matching the pattern, while "''##''"​ tries to do it with the longest text matching. Look at the following examples to get the idea (matched text <​del>​marked striked</​del>,​ remember it will be removed!): The operator "''#''"​ will try to remove the shortest text matching the pattern, while "''##''"​ tries to do it with the longest text matching. Look at the following examples to get the idea (matched text <​del>​marked striked</​del>,​ remember it will be removed!):
 ^Syntax^Result^ ^Syntax^Result^
-|''​${MYSTRING#​*in}''​|<​del>​Be liberal in</​del>​ what you accept, and Be conservative in what you send| +|''​${MYSTRING#​*in}''​|<​del>​Be liberal in</​del>​ what you accept, and conservative in what you send| 
-|''​${MYSTRING##​*in}''​|<​del>​Be liberal in what you accept, and Be conservative in</​del>​ what you send|+|''​${MYSTRING##​*in}''​|<​del>​Be liberal in what you accept, and conservative in</​del>​ what you send|
  
 ==== From the end ==== ==== From the end ====
Line 246: Line 246:
 In the second form everything will be the same, except that Bash now tries to match the pattern from the end of the string: In the second form everything will be the same, except that Bash now tries to match the pattern from the end of the string:
 ^ Syntax ​                                ^ Result ​                                                                         ^ ^ Syntax ​                                ^ Result ​                                                                         ^
-| ''​${MYSTRING%Be*}'' ​                   | Be liberal in what you accept, and Be conservative <​del>​in what you send</​del> ​ | +| ''​${MYSTRING%in*}'' ​                   | Be liberal in what you accept, and Be conservative <​del>​in what you send</​del> ​ | 
-| ''<​nowiki>​${MYSTRING%%Be*}</​nowiki>'' ​ | Be liberal <​del>​in what you accept, and Be conservative in what you send</​del> ​ |+| ''<​nowiki>​${MYSTRING%%in*}</​nowiki>'' ​ | Be liberal <​del>​in what you accept, and Be conservative in what you send</​del> ​ |
  
-The second form nullifies variables that begin with ''​Be'',​ by working from the end.+The second form nullifies variables that begin with ''​in'',​ by working from the end.
 ==== Common use ==== ==== Common use ====
 __**How the heck does that help to make my life easier?**__ __**How the heck does that help to make my life easier?**__
  • syntax/pe.txt
  • Last modified: 2021/12/10 08:12
  • by ajrou