# matchPrefixSuffix {#matchPrefixSuffix}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`matchPrefixSuffix(textCol, prefix, suffix, \[scoreColName\])`

## Arguments {#arguments}

**textCol** is the column to be searched, i.e., the column with text indexing set in the PKEY engine.

**prefix** is a STRING scalar specifying the prefix to search for.

**suffix** is a STRING scalar specifying the suffix to search for.

**scoreColName** \(optional\) is a STRING scalar specifying the column name of the text matching score in the output. The default value is null, which means no score column is output. The matching score indicates the degree of matching within a partition; scores across different partitions are not comparable.

## Details {#details}

Perform text searches based on both prefix and suffix on the column with text indexing set in the PKEY engine. This function is used in the `where` clause of a SQL statement.

**Return value**: Rows containing words with both the specified prefix and suffix.

## Examples {#examples}

``` {#codeblock_mgc_ylv_fdc}
// Generate data for queries
stringColumn = ["There are some apples and oranges.","Mike likes apples.","Alice likes oranges.","Mike gives Alice an apple.","Alice gives Mike an orange.","John likes peaches, so he does not give them to anyone.","Mike, can you give me some apples?","Alice, can you give me some oranges?","Mike traded an orange for an apple with Alice."]
t = table([1,1,1,2,2,2,3,3,3] as id1, [1,2,3,1,2,3,1,2,3] as id2, stringColumn as remark) 
if(existsDatabase("dfs://textDB")) dropDatabase("dfs://textDB")
db = database(directory="dfs://textDB", partitionType=VALUE, partitionScheme=[1,2,3], engine="PKEY")
pt = createPartitionedTable(dbHandle=db, table=t, tableName="pt", partitionColumns="id1",primaryKey=`id1`id2,indexes={"remark":"textindex(parser=english, lowercase=true, stem=true)"})
pt.tableInsert(t)

// Search for rows containing words prefixed with "m" and suffixed with "ke"
select * from pt where matchPrefixSuffix(remark,"m","ke")
```

|id1|id2|remark|
|---|---|------|
|1|2|Mike likes apples.|
|2|1|Mike gives Alice an apple.|
|2|2|Alice gives Mike an orange.|
|3|1|Mike, can you give me some apples?|
|3|3|Mike traded an orange for an apple with Alice.|

