# Tag Replace - [Python Regular Expressions](Python-Regular-Expressions) Sub function - [Definitions](#definitions) - [Introduction](#introduction) - [Simple `replace ` processing](#simple-replace-tag-string-processing) - [User attribute `replace ` processing](#user-attribute-replace-tag-userreplacement-processing) - [Example](#example) ## Definitions ``` ::= country| countrycode| customtype| extendedaddress| formatted| locality| pobox| postalcode| primary| region| streetaddress| type ::= domain| primaryemail| username ::= customtype| type| value ::= addressmeas| customgender| type ::= customtype| type| value ::= customtype| type| value ::= area| buildingid| buildingname| customtype| deskcode| floorname| floorsection| type ::= familyname| fullname| givenname ::= costcenter| customtype| department| description| domain| fulltimeequivalent| location| name| primary| symbol| title| type ::= address| customtype| primary| type ::= customtype| primary| type| value ::= accountid| gecos| gid| homedirectory| operatingsystemtype| primary| shell| systemid| uid| username ::= customtype| type| value ::= expirationtimeusec| fingerprint| key ::= customtype| primary| type| value ::= address.| email.| externalid.| gender.| im.| keyword.| location.| name.| organization.| otheremail.| phone.| posix.| relation.| sshkeys.| website.| ::= address...| externalid...| im...| keyword...| location...| organization...| otheremail...| phone...| posix...| relation...| sshkeys...| website... ::= photourl ::= ::= (field:)| (field:)| (field:)| (schema:.)| ``` ## Introduction Several commands use template files for messages and signatures; Gam has the ability to replace tags in the template with data from the command line or from user attributes. ## Simple `replace ` processing This command allows simple text replacement in the message. ``` gam sendemail [from ] [replyto ] [cc ] [bcc ] [singlemessage []] [subject ] [message |(file [charset ])] (replace )* [html []] (attach )* ``` * Every instance of `{Tag}` in the message will be replaced by ``. * Instances of the form `{RT}...{Tag1}...{Tag2}...{/RT}` will be eliminated if there are no `` values for all `TagN` or if the `` values are all empty strings. * Instances of the form `{RTL}...{RT}...{Tag1}...{/RT}{RT}...{Tag2}...{/RT}{/RTL}` will be eliminated if none of the embedded `{RT}...{Tag}...{/RT}` have values. You can control the case of the letters in `replace `: * `{PC}...{Tag1}...{Tag2}...{/PC}` - For all sequences of letters between `{PC}` and `{/PC}`, the first letter is converted to uppercase, subsequent letters to lowercase. * `{UC}...{Tag1}...{Tag2}...{/UC}` - All letters between `{UC}` and `{/UC}` will be converted to uppercase * `{LC}...{Tag1}...{Tag2}...{/LC}` - All letters between `{LC}` and `{/LC}` will be converted to lowercase ## User attribute `replace ` processing These commands allow simple text replacement in the message/signature as well as substitution of select user attributes. ``` gam create user * [notify ] [subject ] [message |(file [charset ])] [html []] (replace )* gam update user [updateprimaryemail ] [updateoufromgroup [charset ] [columndelimiter ] [noescapechar ] [quotechar ] [fields ] [keyfield ] [datafield ]] [clearschema ] [clearschema .] [createifnotfound] [notify ] [subject ] [message |(file [charset ])] [html []] (replace )* gam draft message (