Jump to content
UBot Underground

Regex-Adding a Character Before and After a String


Recommended Posts

Hello UBoters 

 

I need help on adding speech marks before and after strings from a file:

 

Example:

 

Before:

 

word one

word two

word three

word four

 

After:

 

"word one"

"word two"

"word three"

"word four"

 

 
Thanks for the help  :)
Link to post
Share on other sites

one way is to loop through that list and put variable between quotes like this

 

set(#word one"word one""Global")
set(#word one1"\"{#word one}\"""Global")

 

 

you can even save it that way if you scraping it like

 

set(#word one"word one""Global")
add item to list(%list"\"{#word one}\"""Delete""Global")

 

TC

  • Like 1
Link to post
Share on other sites

The other way is with a single regex replace command:

set(#LIST, "\"{$replace regular expression("word one
word two
word three
word four", "\\n", "\"{$new line}\"")}\"", "Global")

Notice that this won't work if your word contains new line character (but I think that's not your case).

Link to post
Share on other sites

The other way is with a single regex replace command:

set(#LIST, "\"{$replace regular expression("word one
word two
word three
word four", "\\n", "\"{$new line}\"")}\"", "Global")

Notice that this won't work if your word contains new line character (but I think that's not your case).

The function speech marks seem to change $new line function to just "new line" when I edit the $replace regular expression function the speech marks are not there anymore.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...