I'm trying to make a wiki markdown style parser where I have headers defined by hashtags. Eg: # Heading 1 Some information here below the heading Another paragraph of information ## Subheading 1 Paragraph related to the subheading What I'm trying to do is capturing everything between one hash tag and another hashtag (as well as the hash tags themselves) So in the above, I would w
我正在尝试制作一个wiki标记样式解析器,其中包含由标签定义的标头。 例如: # Heading 1 Some information here below the heading Another paragraph of information ## Subheading 1 Paragraph related to the subheading 我想要做的是捕获一个哈希标签和另一个哈希标签之间的所有内容(以及哈希标签本身) 所以在上面,我想要捕捉 Heading 1 (and #) Some information here below the heading Another paragra
I'm using the following regex to find IMG bbcodes and their contents in forum posts: ~[img(?:=['"]?([^,]*?)(?:,[^]'"]+)?['"]?)?]([^[]+)?[/img]~i This works so far, but i need to define exceptions. I must find all IMG bbcodes, which are NOT surrounded by a TT- or CODE bbcode. I'm not trying to parse BBCodes (because this is done by the forum software itself). So i want the img bbcode
我使用以下正则表达式在论坛帖子中查找IMG bb代码及其内容: ~[img(?:=['"]?([^,]*?)(?:,[^]'"]+)?['"]?)?]([^[]+)?[/img]~i 这工作到目前为止,但我需要定义例外。 我必须找到所有的IMG bb代码,这些bb代码没有被TT-或者代码bbcode包围。 我不想解析BBCodes(因为这是由论坛软件本身完成的)。 所以我想从这里的img bbcode(这是工作,使用上面的正则表达式): Hello, this is an example: [img]xxx[/img] - Yay! 但不
If I'm making a forum, guestbook, comment section etc. in PHP, and someone inputs text such as hi and instead of it showing up in red, it shows up as raw text. I've tried using htmlentites() and htmlspecialchars() but the thing is I'm doing a preg_replace() to replace bbcode tags as html tags, like a forum system. If i use htmlspecialchars() before the replace, it doesn't work.
如果我在PHP中创建论坛,留言板,评论部分等,并且某人输入喜欢的文本,而不是以红色显示,则它显示为原始文本。 我尝试过使用htmlentites()和htmlspecialchars(),但事情是我正在做一个preg_replace()来将bbcode标记替换为html标记,就像论坛系统一样。 如果在替换之前使用htmlspecialchars(),则不起作用。 但是,如果在替换后使用htmlspecialchars(),则会显示我作为原始文本转换的html标记。 <html> <
I'm programming a wiki with BBCode-like editing syntax. I want the user to be allowed to enter line breaks that resolve to <br> tags. Until here there's no problem occuring. Now i also have the following lines, that should convert into a table: [table] [row] [col]Column1[/col] [col]Column2[/col] [col]Column3[/col] [/row] [/table] All those lin
我正在编写一个类似BBCode的编辑语法的wiki。 我希望用户被允许输入换行符来解析<br>标签。 直到这里,没有发生问题。 现在我也有以下几行,应该转换成表格: [table] [row] [col]Column1[/col] [col]Column2[/col] [col]Column3[/col] [/row] [/table] 所有这些换行符在格式化上面的可编辑BBCode时都会创建强制在html表格前面呈现的<br>标记。 我的目标是使用php的preg_
I have this bbcode tag "remover" which should remove bbcode tags from my test text. All i get is nothing. Just blank page where should be the text replaced with html tags. Whats wrong with it. And maybe anyone have some better script to share. $str = 'This [b]is just[/b] a [i]test[/i] text!'; function forum_text($str) { $str = htmlspecialchars($str); $str = preg_replace( "#[url](?
我有这个bbcode标签“卸妆”,它应该从我的测试文本中删除bbcode标签。 我得到的只是一无所有。 只是空白页应该是文本替换为html标签。 它出什么问题了。 也许任何人都可以有更好的脚本来分享。 $str = 'This [b]is just[/b] a [i]test[/i] text!'; function forum_text($str) { $str = htmlspecialchars($str); $str = preg_replace( "#[url](?:http://)?(.+?)[/url]#is", "<a href="http://$1">$1</a>", $str )
I have a tiny bbcode parser which works very well, except pre and code tags. I need to make pre and code tags ignored by the whole parser function. How would I achive this ? If any one have an idea please let me know. What I'm trying to do is when I use <pre> or <code> tags it will ignore the bbcode used inside, but parse it everywhere else on the page. I think it can be ach
我有一个很小的bbcode解析器,除了pre和code标签之外,它工作得很好。 我需要使整个解析器函数忽略预编码和代码标记。 我将如何实现这一目标? 如果有人有想法,请告诉我。 我试图做的是当我使用<pre>或<code>标签时,它会忽略里面使用的bbcode,但是解析它在页面上的其他地方。 我认为它可以通过正则表达式和preg_match或preg_replace来实现一些方法。 function parse($text) { $search = array( '/**
I can't quite figure out the right pattern to use with PHP's preg_replace function. Here is an example of some BBCode on a phpBB forum. [color=black][font=Times New Roman][color=black]Thanks. As discussed last night/this morning, we were able to Cable and provide some small relief. After enough waste water was evacuated, the camera diagnosis found at 30 foot from clean-out, heavy root p
我无法弄清楚使用PHP的preg_replace函数的正确模式。 这是一个在phpBB论坛上的BBCode的例子。 [color=black][font=Times New Roman][color=black]Thanks. As discussed last night/this morning, we were able to Cable and provide some small relief. After enough waste water was evacuated, the camera diagnosis found at 30 foot from clean-out, heavy root penetration and possible damage/separation to the line. W
I am looking to scrap a Chinese website using PHP and CURL . Earlier I had an issue with the compressed results and SO had helped me to sort it out. Now I'm facing a trouble while parsing the contents through PHP - DOMDocument . The error is as follows, Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xE3 0x80 0x90 0xE8 in /var/www/html/ .. Even though
我正在寻找使用PHP和CURL取消 中文网站 。 早些时候,我遇到了一个压缩结果的问题,所以我帮助我整理了一下。 现在,我在通过PHP解析内容时遇到了麻烦- DOMDocument 。 错误如下, Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xE3 0x80 0x90 0xE8 in /var/www/html/ .. 尽管警告这阻止了进一步的结果。 我的代码如下所示: $agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x
I need to parse the contents of a HTML document (produced by Microsoft Word). Traversing the DOM to get the information/contents I need then outputting the desired as a CSV. Hardly brain surgery I know. Now as PHP isn't really my thing and I have a tight schedule I was going to use the PHP Simple HTML DOM Parser from http://simplehtmldom.sourceforge.net/ I noticed that my script isn'
我需要解析HTML文档(由Microsoft Word制作)的内容。 遍历DOM以获取我需要的信息/内容,然后将所需的信息输出为CSV。 我知道,几乎没有脑部手术。 现在,由于PHP并不是我的东西,而且我的计划很紧张,所以我将使用http://simplehtmldom.sourceforge.net/中的PHP Simple HTML DOM解析器 。 我注意到我的脚本不工作。 经过试验和错误之后,我意识到这是由于Word生成的HTML文件的文件大小(它们是3MB,并且有多达30,000行HT
Is it possible using PHP Simple HTML DOM Parser to add a new script taga inside the head of a simple_html_dom object that has a full html from a home page? i need to add some nodes inside that template, one of this nodes is a script tag with jquery and the other is a div with some text that i am pulling from my database. i previously did something like this: (with DOMDocument ) $dom = new DO
是否可以使用PHP Simple HTML DOM Parser在主页中包含完整html的simple_html_dom对象的头部添加新脚本taga? 我需要在该模板中添加一些节点,其中一个节点是带有jQuery的脚本标记,另一个是带有一些文本的div,我从数据库中提取。 我以前做过这样的事情:(用DOMDocument) $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($remote); $head = $dom->getElementsByTagName('head')->item(0); $jquery = '$(do