如何检索带有<chem>与<math chem>标签的维基百科条目
Since regular Wikipedia search ignores angle brackets like < and >, you need more targeted tools to track down articles with these chemistry-specific tags. Here are three reliable, actionable methods:
Use Wikipedia's Advanced Search
This is the simplest no-code approach. Head to Wikipedia's advanced search interface, then locate the "Page content" section. Enter<chem>directly into the text box, or combine both tags with the OR operator:<chem> OR <math chem>. To filter out talk pages, user pages, and other non-article content, set the "Namespace" dropdown to "Article" before running the search. This tool respects the angle brackets and returns pages where the raw edit content includes those exact tags.Leverage the Wikipedia API
For more control (or to automate the search), use the Wikipedia API with custom search parameters. You can target pages containing the tags using theinsource:prefix. For example, a query likeinsource:"<chem>" OR insource:"<math chem>"will pull up pages with either tag. To restrict results to main-space articles (the core Wikipedia content), addsrnamespace=0to your API request. You can test this directly in the API sandbox or build a simple script to fetch results programmatically.Query with Wikidata SPARQL
If you’re comfortable with structured queries, Wikidata’s SPARQL endpoint lets you retrieve articles based on their raw content. A basic query to find articles with either tag would look like this:SELECT ?article ?articleLabel WHERE { ?article schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> ; schema:text ?text . FILTER (CONTAINS(?text, "<chem>") || CONTAINS(?text, "<math chem>")) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } }This returns English Wikipedia articles with the tags, along with their human-readable labels for clarity.
A quick note: All these methods target the raw edit content of pages (where <chem> and <math chem> tags are stored), not the rendered view. So you’ll get exactly the pages where editors used these chemistry formatting tags.
内容的提问来源于stack exchange,提问作者mhchem

