Sub Main
Dim oDocument As Object
Dim oSearch As Object, oResult As Object
Dim oFound As Object, oFoundCursor As Object
Dim n As Long
oDocument = ThisComponent
oSearch = oDocument.createSearchDescriptor
'oSearch.SearchString = "the[a-z]"
oSearch.SearchString = "x"
oSearch.SearchRegularExpression = TRUE
oResult = oDocument.findAll(oSearch)
For n = 0 To oResult.count - 1
oFound = oResult(n)
oFoundCursor = oFound.Text.createTextCursorByRange(oFound)
oFoundCursor.CharWeight = com.sun.star.awt.FontWeight.BOLD
Next n
'oSearch.SearchString = "all[a-z]"
oSearch.searchString = "y"
oFound = oDocument.findFirst(oSearch)
While NOT IsNull(oFound)
oFoundCursor = oFound.Text.createTextCursorByRange(oFound)
oFoundCursor.CharPosture = com.sun.star.awt.FontSlant.ITALIC
oFound = oDocument.findNext(oFound, oSearch)
Wend
End Sub