Replace varying text in between <eb:PartyId></eb:PartyId> - text

How can I make the change with Notepad++?
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
should be
<eb:PartyId>PRINT</eb:PartyId>
The difficult thing for me is that the name section varies. I have tried several ways have not managed to find how this should be done.

Try a regex find/replace in notepad++, like so:
Find: <eb:PartyId>.*.</eb:PartyId>
Replace: <eb:PartyId>PRINT</eb:PartyId>

In Notepad++ you can do it easily using regular expressions. First of all, make sure that your N++ version is the latest 6.5.1, or at least >= 6.0, and then go to Search > Replace menu (shortcut CTRL+H) and do the following:
Find what:
(<eb:PartyId>)[^<]+(<\/eb:PartyId>)(?!.+<\/eb:From>)
Replace:
$1PRINT$2
Select radio button "Regular Expression" & check ". matches newline"
Then press Replace All
This will convert the following data:
<eb:From>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
</eb:To>
To:
<eb:From>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
<eb:PartyId>Surename Secondname Firstname</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId>PRINT</eb:PartyId>
<eb:PartyId>PRINT</eb:PartyId>
<eb:PartyId>PRINT</eb:PartyId>
</eb:To>

Related

Hi "Mr." Brad Pitt! in column

Column A - first name list
Column B - last name list
Column C - salutation list
I want in column D: HI "salutation" + first name + last name!
I try ="Hi &C1&" "&A1&" "&B1&"!" -> result Hi Mr. Brad Pitt!
But I want the result Hi "Mr." Brad Pitt!
You can use two double quotes where you want each double quote to be, in order to escape it.
="Hi """&C1&""" "&A1&" "&B1&"!"
you can use 2 double quotes to get a double quote in your text.
Try this instead: ="Hi """&C1&""" "&A1&" "&B1&"!"
Try below formula-
="Hi " & CHAR(34) & C1 & CHAR(34) & " " & A1 &" "&B1&"!"

Bold font to only one word from a cell

How to set bold font to only one word from a cell? The documentation shows how to set all cells to a font type. As an example, I'll add a <b> tag to show which word will be in bold.
ws.cell(index + 4, 2).string(p[i].dataValues.diameter + '\n' + '<b>' + psw[i].dataValues.well + '</b>').style(styleText);

How to extract text from a string after the first instance of repetition is detected?

I want to extract the original phrase from a string, in an excel cell.
For example, i've got this string in a cell:
"mary has a little lamb mary has a little lamb mary has a little lamb..."
I want to extract the original phrase, "mary has a little lamb".
How can i do that?
Try this;
Assuming you have the string "mary has a little lamb mary has a little lamb mary has a little lamb..." in Cell B2, the formula
=MID(B2,1,SEARCH(MID(B2,1,FIND(" ", B2)-1),B2,FIND(" ", B2))-2) will give you the desired result.
This formula has a limitation that the first word does not repeat within the original phrase.
Assuming the question is actually about VBA, you can use InStr(FullText, SearchedText) to get the position of the first sought text string within a string.
Sub LambHunting()
A = "mary has a little lamb"
B = "mary has a little lamb mary has a little lamb mary has a little lamb..."
C = "Mary HAD a little lamb; unfortunately mary has a little lamb no longer."
Debug.Print "'" & A & "' is at position #" & InStr(B, A) & " in the string '" & B & "'"
Debug.Print "'" & A & "' is at position #" & InStr(C, A) & " in the string '" & C & "'"
End Sub
Returns:
'mary has a little lamb' is at position #1 in the string 'mary has a little lamb mary has a little lamb mary has a little lamb...'
'mary has a little lamb' is at position #39 in the string 'Mary HAD a little lamb; unfortunately mary has a little lamb no longer.'

How to convert circled numbers to numbers ? (① to 1)

I would like to convert numbers from a string I receive after an OCR recognition over Japanese text.
For example, when I extract a date:
③① 年 ⑫ 月 ①③ 日
I would like to convert it to:
31 年 12 月 13 日
What would be the best way to achieve it ?
I would use unicodedata
import unicodedata
print(unicodedata.normalize("NFKC","③① 年 ⑫ 月 ①③ 日"))
The result is this,
31 年 12 月 13 日
This also converts other variation of Japanese digits, full-width digits.
import unicodedata
print(unicodedata.normalize("NFKC","123①②③123"))
to
123123123
Assuming you already have the text OCR'd to the circled numbers in your question, a simple text replace will suffice. Here's how you'd do it in Python:
def uncircle(s):
for i in range(1, 21):
s = s.replace(chr(0x245f + i), str(i))
return s.replace('\u24ea', '0')
The circled numbers 1 through 20 are the Unicode codepoints 0x2460 through 0x2473, and the circled number 0 is the Unicode codepoint 0x24ea.

jquery autocomplete specific bold issue

I've got autocomplete source with values like 'JOHN SMITH', 'LIN SMITH', JOHN STAINIGER';
I want to enable user if he writes SMITH in the output to see also the suggestions ''JOHN SMITH', 'LIN SMITH' and when he writes SMITH J he should see only JOHN SMITH.
So I've made autocomplete to search both ways - JOHN S and SMITH J will both give me JOHN SMITH
The problem is with bold- I've made this function which makes the req. term item bold no matter where it finds the req. erm in the string.
But if I write SMITH J and that's my req. term then it will bold nothing because it cannot find this req. term in JOHN SMITH. How can i change that?
How can i change that
function monkeyPatchAutocomplete() {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
var highlighted = item.label.split(this.term).join('<strong>' + this.term + '</strong>');
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + highlighted + "</a>")
.appendTo(ul);
}
}

Resources