![]() ![]() original_string: This source string contains the set of characters to be replaced. ![]() Syntax: TRANSLATE(original_string, set_of_characters, new_set_characters) When you need to replace more than one substring with the same substring, you can use the translate() Function in PostgreSQL. select regexp_replace('This is first plant that does synthesis.','is','demo','') Īnd the only first occurrence of is would have been replaced with the demo. If we had not mentioned the ‘g’ flag and fired the following query. Select regexp_replace('This is first plant that does synthesis.','is','demo','g') We will use the REGEXP_REPLACE() Function, and our query statement will be as follows. “This is the first plant that does synthesis.” we want to replace all the words containing the substring ‘is’ to the substring ‘demo’. For example,’ means that the comparison should be case-insensitive, and g specifies global substitution of the substring, which means all occurrences are to be replaced.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |