All Projects → rust-onig → Rust Onig

rust-onig / Rust Onig

Licence: other
Rust bindings for the Oniguruma regex library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rust Onig

Netflix To Srt
Rip, extract and convert subtitles to .srt closed captions from .xml/dfxp/ttml and .vtt/WebVTT (e.g. Netflix, YouTube)
Stars: ✭ 387 (+377.78%)
Mutual labels:  hacktoberfest, regex
Lens Regex Pcre
Text lenses using PCRE regexes
Stars: ✭ 116 (+43.21%)
Mutual labels:  hacktoberfest, regex
Mattermost Plugin Gitlab
GitLab plugin for Mattermost
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Flutter web auth
Flutter plugin for authenticating a user with a web service
Stars: ✭ 81 (+0%)
Mutual labels:  hacktoberfest
Windows exporter
Prometheus exporter for Windows machines
Stars: ✭ 1,230 (+1418.52%)
Mutual labels:  hacktoberfest
Bootstrap Form Builder
🔖 A drag-and-drop form builder for Bootstrap 4.
Stars: ✭ 79 (-2.47%)
Mutual labels:  hacktoberfest
Commudle Ng
World's first community management platform. And it's free!
Stars: ✭ 81 (+0%)
Mutual labels:  hacktoberfest
Iis
Development repository for the iis cookbook
Stars: ✭ 79 (-2.47%)
Mutual labels:  hacktoberfest
Noredink Ui
UI widgets we use -- https://noredink-ui.netlify.com/
Stars: ✭ 81 (+0%)
Mutual labels:  hacktoberfest
Theodinproject
Main Website for The Odin Project
Stars: ✭ 1,227 (+1414.81%)
Mutual labels:  hacktoberfest
Gitmad
Monitor, Alert, and Discover sensitive info and data leakage on Github.
Stars: ✭ 81 (+0%)
Mutual labels:  regex
Vpk
📦 Open, Search, Extract and Create VPKs in python
Stars: ✭ 79 (-2.47%)
Mutual labels:  hacktoberfest
Greenswitch
Battle proven FreeSWITCH Event Socket Protocol client implementation with Gevent
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Ign Gazebo
Open source robotics simulator. Through Ignition Gazebo users have access to high fidelity physics, rendering, and sensor models. Additionally, users and developers have multiple points of entry to simulation including a graphical user interface, plugins, and asynchronous message passing and services. Ignition Gazebo is derived from Gazebo, and represents over 16 years of development and experience in robotics and simulation. This library is part of the Ignition Robotics project.
Stars: ✭ 81 (+0%)
Mutual labels:  hacktoberfest
Betaflight Esc
Open source ESC firmware.
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Dockest
Docker + Jest integration testing for Node.js
Stars: ✭ 81 (+0%)
Mutual labels:  hacktoberfest
Pentydesktopassistant
Penty is a small Desktop Assistant programmed with JS and Python as its backend and HTML and CSS as its front. Took just over a month to create v1.0. It has a few features, like an in-built gMail sender and a quick-open browser.
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Udoit
The Universal Design Online content Inspection Tool, or UDOIT (pronounced, “You Do It”) enables faculty to identify accessibility issues in Canvas by Instructure. It will scan a course, generate a report, and provide resources on how to address common accessibility issues.
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Kde
[MIRROR] KDE team's testing overlay
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Snackbar
toast-like alert pattern for Android inspired by the Google Material Design Spec
Stars: ✭ 1,234 (+1423.46%)
Mutual labels:  hacktoberfest

Rust Onig

Cargo Documentation CI Build status dependency status

Rust bindings for the Oniguruma regex library, a powerful and mature regular expression library with support for a wide range of character sets and language syntaxes. Oniguruma is written in C. This repository provides two crates: onig-sys which provides the raw Rust FFI bindings, and onig, which provides a safe Rust wrapper around them.

Documentation

Check out the module documentation to find out all the features that are available. To see some example usage of this crate take a look a the examples folder. The examples can be run from the command line with cargo run --example <examplename>.

Getting Started

Add the following to your Cargo.toml file:

[dependencies]
onig = "6"

Add the following extern to your crate root if you are not using edition 2018:

extern crate onig;

You can compile simple regular expressions with Regex::new, check if the pattern matches an entire &str with Regex::is_match and find matches within a &str with Regex::find. The onig crate also supplies more powerful versions of these methods which expose the wide range of options Oniguruma provides.

use onig::*;

let regex = Regex::new("e(l+)").unwrap();
for (i, pos) in regex.captures("hello").unwrap().iter_pos().enumerate() {
    match pos {
         Some((beg, end)) =>
             println!("Group {} captured in position {}:{}", i, beg, end),
         None =>
             println!("Group {} is not captured", i)
    }
}

Linking

If a version of Oniguruma can be found by pkg-config then that will be used. If not then Oniguruma will be compiled from source and linked to the onig-sys crate.

By default rust-onig will be statically linked to libonig. If you would rather that dynamic linking is used then the environment variables RUSTONIG_STATIC_LIBONIG and RUSTONIG_DYNAMIC_LIBONIG can be set. On *nix:

$ RUSTONIG_DYNAMIC_LIBONING=1 cargo build

Or Windows:

> set RUSTONIG_DYNAMIC_LIBONIG=1
> cargo build

Build errors caused by libclang/llvm

By default onig uses bindgen to generate bindings for libonig. If you plan to only use the bundled version of libonig, you can make compilation faster and more reliable by disabling the default generate feature:

[dependencies]
onig = { version = "6", default-features = false }

Debugging

Sometimes it's useful to debug how Oniguruma parses, compiles, optimizes or executes a particular pattern.

When activating the print-debug feature for this crate, Oniguruma is compiled with debugging. Note that it's a compile-time setting, so you also need to make rust-onig not use the system Oniguruma by using RUSTONIG_SYSTEM_LIBONIG.

With all that combined, here's an example command to debug the pattern a|b:

RUSTONIG_SYSTEM_LIBONIG=0 cargo run --features print-debug --example capturedump 'a|b'

Supported Rust Versions

Rust Onig supports Rust 1.40.0 or later for Windows, Linux, and macOS. If the minimum supported rust version is changed then the minor version number will be increased. That is v6.1.x should always compile with the same version of the compiler.

Rust-Onig is Open Source

The contents of this repository are distributed under the MIT license. See LICENSE for more details. If you'd like to contribute take a look at our open easy issues.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].