How to get text form element with other element inside and text

My code is following:

WebUI.waitForElementPresent(findTestObject(‘Object Repository/Page Product/divMessageProductAdded’), GlobalVariable.timeout)
String actualDivMessage = WebUI.getText(findTestObject(‘Object Repository/Page Product/divMessageProductAdded’))

And I am getting this message:
“Selenium Ruby” has been added to your basket.

However, i just need to get “Selenium Ruby” has been added to your basket.


View Basket “Selenium Ruby” has been added to your basket.

I can suggest using String manipulation. Copy and paste your text message into an app, such as Notepad++ that also displays unseen characters, and see if there is some carriage return or new line feed that separates the two pieces of text. Then use actualDivMessage.split("\\n") on the text. Other options are \\v and \\R.

WebUI.waitForElementPresent(findTestObject('Page Product/divMessageProductAdded'), GlobalVariable.timeout)
String actualDivMessage = WebUI.getText(findTestObject('Page Product/divMessageProductAdded'))

String basketMsg = actualDivMessage.split("\\n")[1]


Another option may be to use String basketMsg = actualDivMessage.substring(12)

Thanks grylion54 to help me, I am going to test now.