用unicode(日语)字符问题的正则表达式python(regex python with unicode (japanese) character issue)
我想删除下面的一部分字符串(以粗体显示),它存储在字符串oldString中
[DMSM-8433] 加护亜依 Kago Ai - 加护亜依与FRIDAY
即时通讯在Python中使用以下正则表达式
p=re.compile(ur"( [\W]+) (?=[A-Za-z ]+–)", re.UNICODE) newString=p.sub("", oldString)
当我输出newString什么都没有被删除
I want to remove part of a string (shown in bold) below, this is stored in the string oldString
[DMSM-8433] 加護亜依 Kago Ai – 加護亜依 vs. FRIDAY
im using the following regex within python
p=re.compile(ur"( [\W]+) (?=[A-Za-z ]+–)", re.UNICODE) newString=p.sub("", oldString)
when i output the newString nothing has been removed
原文:https://stackoverflow.com/questions/32863608
最满意答案
有一个更简单的方法来做到这一点:
$(newHtml).appendTo('#myDiv').effects(...);
首先使用
jQuery(html [, ownerDocument ])
创建newHtml
,然后使用appendTo(target)
(注意“To
”位)将其添加到#mydiv
的末尾,这样就可以了。因为你现在以
$(newHtml)
开头 ,appendTo('#myDiv')
$(newHtml)
的最终结果是html的新位,而.effects(...)
调用也将在这个新的位置上。There's a simpler way to do this:
$(newHtml).appendTo('#myDiv').effects(...);
This turns things around by first creating
newHtml
withjQuery(html [, ownerDocument ])
, and then usingappendTo(target)
(note the "To
" bit) to add that it to the end of#mydiv
.Because you now start with
$(newHtml)
the end result ofappendTo('#myDiv')
is that new bit of html, and the.effects(...)
call will be on that new bit of html too.
相关问答
更多-
我想你需要after而不是append : function (data) { $parent.append(data); } 应该 function (data) { $parent.after(data); } 此外, live现在实际上已被弃用。 你应该使用。 I think you need after and not append: function (data) { $parent.append(data); } should be function (data) { $parent.af ...
-
使用递归的jQuery附加元素不会逐个显示(jQuery appended element using recursion is not displayed one by one)[2022-01-24]
sleep方法中的繁忙循环阻止了您的浏览器更新屏幕。 它阻止浏览器。 所以这不是一个好的方法。 而是让你的代码异步。 如果你有支持async/await那么你可以这样做: async loadSections(sections, buttons) { for (let section of sections) { await this.sleep(section.DelayInMs); let context = { message: sect ... -
有一个更简单的方法来做到这一点: $(newHtml).appendTo('#myDiv').effects(...); 首先使用jQuery(html [, ownerDocument ])创建newHtml ,然后使用appendTo(target) (注意“ To ”位)将其添加到#mydiv的末尾,这样就可以了。 因为你现在以$(newHtml) 开头 , appendTo('#myDiv') $(newHtml)的最终结果是html的新位,而.effects(...)调用也将在这个新的位置上。 ...
-
根据你的评论。 它几乎看起来像添加.tweet元素的函数异步执行(也许是一个ajax请求?)如果是这种情况,该方法不会阻止代码执行,这将带来你的行为。 在这种情况下你需要做的是,为获取和创建推文的函数提供回调函数。 如果已完成,请执行回调。 function get_tweets() { var requests = [ ]; for(var i = 0; i < 5; i++) { requests.push( $.getJSON('/foo' + i + '.json' ...
-
只需添加这个 $('#send').on('click', function(event){ event.preventDefault(); //rest of the code }); 要么 $("#send").click(function(event) { event.preventDefault(); //rest of the code }); 防止表单提交或超链接导航。 当您想要将内容重新发送回服务器后端时,这也可以提供更好的控制 just add this $(' ...
-
这应该对你有用: $(".companylogo").on("click", "#change_profile_img", function() { alert(1); }); This should work fine for you: $(".companylogo").on("click", "#change_profile_img", function() { alert(1); });
-
如何在使用JQuery切换DIV后删除附加元素?(How removing an appended element after a DIV is toggled using JQuery?)[2023-04-20]
这很容易,而不是使用追加,使用HTML。 $("#DIVA").toggle(function(){ var my_div_to_be_appended = "my div"; // This will replace the content every time the toogle function is called. $("DIVA").html(my_div_to_be_appended); }); That's easy, i ...$(document).on('click','.remove-file', function(){ 尝试这个 $(document).on('click','.remove-file', function(){ Try This想出原因。 在drop: function() ,我有一个accept:选项,该值是DOM元素,类型为类,存储在变量中。 因此,变量未引用任何附加元素,因此函数不会捕获它们 var UI = { var item = $('.the_item') } drop: function() { accept: UI.item, } Figured out why. Under the drop: function(), I had an accept: option, which value w ...append调用中的未闭合HTML标记会自动给出结束标记。 因此,代码 jQuery("#photodiv").append("") 是相同的 jQuery("#photodiv").append("") 因此, 和