Snippets Collections
import re

text = 'this is a text'

try:
    found = re.search('is(.+?)text', text).group(1)
except AttributeError:
    # AAA, ZZZ not found in the original string
    found = '0 wtitle' # apply your error handling
found

=> a
/* This will come in the body at XML but the header will be text/plain, which is why  
all this is happening manually to get this read from the stream.  
*/  
var reqHeaders = request.headers;
gs.info("CPSNS: reqHeaders content-type" + reqHeaders['content-type']);
if (reqHeaders['content-type'] == "text/plain; charset=UTF-8") {
    var stream = request.body.dataStream;
    var reader = new GlideTextReader(stream);
    var input = "";
    var ln = "";
    while ((ln = reader.readLine()) != null) {
        input += ln;
    }
    gs.info("CPSNS: SUB" + input);
} else {
    var body = {};
    var data = request.body.data;

    gs.info("CPSNS: req.body data" + data);

}
.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
star

Mon Feb 01 2021 21:22:08 GMT+0000 (UTC) https://developer.servicenow.com/blog.do?p

#servicenow #content #type #plain #text
star

Sun Jan 05 2020 18:59:56 GMT+0000 (UTC) https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/

#css #webdev #text

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension